$findtok

From Scriptwiki
Jump to: navigation, search

Returns the position of the Nth matching token in text.

$findtok(text,token,N,C)

Note that if you specify zero for N, it returns the total number of matching tokens and that it returns $null if it wasn't able to find a token.

Example

echo -ag $findtok(This is a test,a,1,32)

This example would return 3, as a is the third word in the text.

echo -ag $findtok(a.b.b.c.b,b,0,46)

This example would return 3, as there are 3 b's in the text, seperated by dots.