Top

Name

strstr — substring search

Synopsis

strstr ( 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.

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.412. Sample example

strstr('AbracadabrA','abrA')
    -> 7 (Found from the eighth character onwards)
strcasestr('AbracadabrA','abrA')
    -> 0 (Found from the beginning of string)


See Also

strcasestr .