pos. Getting substring's position

^string.pos[substring]
^string.pos[substring](offset)
   [3.3.0]

The method returns a number
int, that is the position of the first character of the substring (beginning with zero), or -1 if substring cannot be found.
If
offset was specified the substring will be searching from specified position.


Examples

$str[Strangers in the night…]
^str.pos[range]


The code will return:
2


$str[
Strangers in the night…]
^str.pos[t](2)


The code will return:
13



Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 18.07.2008