Loading...
Select Version
&pagelevel(4)&pagelevel
Definition | #include <string.h> char *strstr(const char *s1, const char *s2);
| |
Return val. | Pointer to the start of the string found in s1 | |
if s2 is contained in s1. | ||
0 | if s2 is not contained in s1. | |
Pointer to the start of s1 | ||
if s2 has a length of 0. | ||
Notes | Strings terminated with the null byte are expected as arguments. The following two prototypes of the char *strstr( char *s1, const char *s2); | |
Example | #include <string.h> #include <stdio.h> int main(void) { char *s1 = "City: Munich, Name: Peter Mueller"; char *s2 = "Peter"; printf("Full name? %s\n", strstr(s1, s2)); /* Peter Mueller */ return 0; } | |
See also | strchr |