(搜尋字串)
函式:
const char * strstr ( const char * str1, const char * str2 );
char * strstr ( char * str1, const char * str2 );
標頭檔:
string.h
說明:
Locate substring
Returns a pointer to the first occurrence of str2 in str1,
or a null pointer if str2 is not part of str1.
The matching process does not include the terminating null-characters.
example:
#include <stdio.h>
#include <string.h>
int main ()
{
char str[] ="This is a simple string";
char * pch;
pch = strstr (str,"simple");
puts (pch);
return 0;
}
ref :
Here
沒有留言:
張貼留言