Chapter Contents |
Previous |
Next |
strstr |
Portability: | ISO/ANSI C conforming |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
CAUTION | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <string.h> char *strstr(const char *str1, const char *str2);
DESCRIPTION |
strstr
scans the input string
str1
for the first
occurrence of the search string
str2
.
RETURN VALUE |
strstr
returns a character pointer to the first occurrence of the search string in
the input string. If the search string cannot be found,
strstr
returns
NULL
.
CAUTION |
EXAMPLE |
#include <string.h> #include <stdio.h> main() { char *text_buffer ="12345-\n67-\n89"; char *word_break ="-\n"; char *hyphen; hyphen = strstr(text_buffer, word_break); printf("The first occurence of \"-\\n\" is after the digit %c\n", *(hyphen-1)); }
RELATED FUNCTIONS |
SEE ALSO |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.