$pos » History » Version 3
Per Amundsen, 08/11/2015 04:29 AM
1 | 1 | Per Amundsen | _Added in 1.8.10_ |
---|---|---|---|
2 | |||
3 | *$pos(string,substring,N)* |
||
4 | |||
5 | Returns a number indicating the position of the Nth occurrence of string in text. |
||
6 | |||
7 | 3 | Per Amundsen | _[[$pos]] is case-insensitive, see [[$poscs]] for case-sensitive version._ |
8 | 1 | Per Amundsen | |
9 | *Parameters* |
||
10 | |||
11 | string - String to search. |
||
12 | substring- Substringto search. |
||
13 | N - If N = 0, total number of matches, otherwise the Nth match. |
||
14 | |||
15 | *Example* |
||
16 | |||
17 | <pre> |
||
18 | ; Print number of matches for the substring 'e'. |
||
19 | //echo -ag $pos(hello there,e,1) |
||
20 | |||
21 | ; Print the position of the second match using substring 'e'. |
||
22 | //echo -ag $pos(hello there,e,2) |
||
23 | </pre> |