1 |
$loc = index($string, $substr); # returns in $loc the location (first character in $string is location 0) of first occurrence of $substr in $string.
-
If $substr is not found, index returns -1
|
2 |
$loc = index($string, $substr, $firstloc); # returns $loc which is at least as large as $firstloc
-
Use to find multiple occurrences, setting $firstloc as 1+ previously found location
|
3 |
rindex($string, $substr, $lastloc) is identical to index except scanning starts at right (end) of string and not at start. All locations still count from left but if you give a third argument $lastloc, the returned $loc will be at most $lastloc
|