strstr
Scans a string for the first occurrence of a given substring
#include <string.h> char *strstr ( const char *str, const char *substr);
The strstr function returns a pointer to the located string, or NULL if the string is not found.
The strstr function locates the first occurrence in the string pointed to by str of the sequence of characters (excluding the terminating NULL character) in the string pointed to by substr.
#include <string.h> #include <strio.h> main () { printf ("%s\n", strstr ("This is an example", "is") ); }
produces the following:
is is an example