function

strpos . string . sncode

VERSIONlatest Find the position of the first occurrence of a substring in a string.

STRPOS(1e)

NAME

strpos - Finds the position of the first occurrence of a substring in a string.

SYNOPSIS

strpos(where,what,offset)

PARAMETERS

where
The element to search in.
what
The element we are looking for
offset
If specified, the search will start its number of characters counted from the beginning of the string. If negative, the search will be performed from the end of the string.

RETURN

Returns the position of where the needle exists relative to the beginning of the haystack string (independent of offset). Also note that string positions start at 0, and not 1. Returns -1 if the needle was not found.

EXAMPLES

in:  res=<{strpos("ààó","ó")}>.
out: res=2.

in:  res=<{strpos("12345",3)}>.
out: res=2.

in:  res=<{strpos("12345","34",3)}>.
out: res=-1.

AUTHOR

Written by Pusnei Sergey and Caroline Laplante, <sergey@sednove.com>