Core Function StrPos

From Sputnik Wiki
Revision as of 20:54, 28 January 2013 by UberFoX (Talk | contribs)
Jump to: navigation, search
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

Default: 0 (Case sensitive)

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 );
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox