Name
strstr , strindex — substring search
Synopsis
strstr(
|
in str string, |
in sub string); |
strindex(
|
in str string, |
in sub string); |
Description
strstr performs a substring search, returning
a zero-based index pointing to beginning of first occurrence of
sub or NULL if not found.
strindex is an alias of
strstr and behaves identically.
Parameters
str
String to search from.
sub
Substring to search for.
Return Types
An integer zero-based index to first occurrence of
sub .
Examples
Example 24.436. Sample example
strstr('AbracadabrA','abrA')
-> 7 (Found from the eighth character onwards)
strcasestr('AbracadabrA','abrA')
-> 0 (Found from the beginning of string)