Project

General

Profile

$pos » History » Version 4

Per Amundsen, 02/23/2023 07:12 PM

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 4 Per Amundsen
table(ktable).
12
|*Parameter*|*Description*|
13
| string | String to search. |
14
| substring | Substringto search. |
15
| N | If N = 0, total number of matches, otherwise the Nth match. |
16 1 Per Amundsen
17
*Example*
18
19
<pre>
20
; Print number of matches for the substring 'e'.
21
//echo -ag $pos(hello there,e,1)
22
23
; Print the position of the second match using substring 'e'.
24
//echo -ag $pos(hello there,e,2)
25
</pre>