Project

General

Profile

Actions

$pos » History » Revision 3

« Previous | Revision 3/4 (diff) | Next »
Per Amundsen, 08/11/2015 04:29 AM


Added in 1.8.10

$pos(string,substring,N)

Returns a number indicating the position of the Nth occurrence of string in text.

$pos is case-insensitive, see $poscs for case-sensitive version.

Parameters

string - String to search.
substring- Substringto search.
N - If N = 0, total number of matches, otherwise the Nth match.

Example

; Print number of matches for the substring 'e'.
//echo -ag $pos(hello there,e,1)

; Print the position of the second match using substring 'e'.
//echo -ag $pos(hello there,e,2)

Updated by Per Amundsen over 8 years ago · 3 revisions

Also available in: PDF HTML TXT