$count » History » Version 4
Per Amundsen, 02/16/2023 09:17 PM
| 1 | 1 | Per Amundsen | _Added in 1.8.10_ |
|---|---|---|---|
| 2 | |||
| 3 | *$count(string,substring,substring2,...,substringN)* |
||
| 4 | |||
| 5 | Returns the number of times substring occurs in string. |
||
| 6 | |||
| 7 | 2 | Per Amundsen | _[[$count]] is case-insensitive, see [[$countcs]] for case-sensitive version._ |
| 8 | 1 | Per Amundsen | |
| 9 | *Parameters* |
||
| 10 | |||
| 11 | 4 | Per Amundsen | table(ktable). |
| 12 | |*Parameter*|*Description*| |
||
| 13 | | string | The string to search for. | |
||
| 14 | | substring,substring2,...,substringN | Substrings to search. | |
||
| 15 | 1 | Per Amundsen | |
| 16 | *Example* |
||
| 17 | |||
| 18 | <pre> |
||
| 19 | 3 | Per Amundsen | ; Count number of times 'el' appears in 'hello'. |
| 20 | 1 | Per Amundsen | //echo -ag $count(hello,el) |
| 21 | |||
| 22 | 3 | Per Amundsen | ; Count number of times 'l' appears in 'hello'. |
| 23 | 1 | Per Amundsen | //echo -ag $count(hello,l) |
| 24 | </pre> |