STRSTR(3,L) AIX Technical Reference STRSTR(3,L)
-------------------------------------------------------------------------------
strstr
PURPOSE
Locates a substring.
LIBRARY
Standard C Library (libc.a)
SYNTAX
#include <string.h>
char *strstr (string1, string2);
char *string1, *string2;
DESCRIPTION
The strstr function returns a pointer to the beginning of the first occurrence
of string2 in string1. The strstr function does not consider the null
character (\0) that ends string2 in the matching process.
If string2 does not appear in string1, strstr returns NULL.
EXAMPLE
The following example locates the string "hay" in the string ""needle in a
haystack"".
#include <string.h>
char *string1 = "needle in a haystack";
char *string2 = "hay";
char *result;
result = strstr (string1,string2);
/* Result = a pointer to "hay" */
Processed November 7, 1990 STRSTR(3,L) 1