Core Function StrPos
From Sputnik Wiki
(Difference between revisions)
UberFoX (Talk | contribs)
(Created page with "<pre> StrPos( <haystack>, <needle>, <offset>, <flags> ) </pre> === Description === Find the position of the first occurrence of a substring in a string === Parameters === ==...")
Newer edit →
(Created page with "<pre> StrPos( <haystack>, <needle>, <offset>, <flags> ) </pre> === Description === Find the position of the first occurrence of a substring in a string === Parameters === ==...")
Newer edit →
Revision as of 20:50, 28 January 2013
StrPos( <haystack>, <needle>, <offset>, <flags> )
Contents |
Description
Find the position of the first occurrence of a substring in a string
Parameters
haystack
The string to search in.
needle
The string to search for.
offset
Optional; Search will start this number of characters counted from the beginning of the string.
(Cannot be negative)
Default: 0
flags
1 = Case insensitive search
Return Value
Returns the position of where the needle exists relative to the beginning of the haystack (independent of offset). Also note that string positions start at 0, and not 1.
Return -1 on failure (such as did not find)
Remarks
None.
Example
$RET = StrPos("The quick brown FoX", "foX", 0, 1); println( $RET );