strstr

Scans a string for the first occurrence of a given substring.

Library:LibC
Classification:ANSI
Service:Characters and Strings

Syntax

  #include <string.h> 
   
  char *strstr (
     const char   *str,   
     const char   *substr);
  

Parameters

str

(IN) Points to a null-terminated string to scan.

substr

(IN) Points to a null-terminated substring for which to search.

Return Values

Returns a pointer to the located string, or a NULL pointer if the string is not found.

Remarks

The strstr function locates the first occurrence in the string pointed to by str of the sequence of characters (excluding the null-terminating character) in the string pointed to by substr.

See Also