记录个函数 strstr
包含文件:string.h
函数名: strstr
函数原型:extern char *strstr(char *str1, char *str2);
功能:找出str2字符串在str1字符串中第一次出现的位置(不包括str2的串结束符)。
返回值:返回该位置的指针,如找不到,返回空指针。
编辑本段
函数原型
1.Copyright 1990 Software Development Systems, Inc.
char *strstr( const char *s1, const char *s2 ){ int len2; if ( !(len2 = strlen(s2)) ) return (char *)s1; for ( ; *s1; ++s1 ) { if ( *s1 == *s2 && strncmp( s1, s2, len2 )==0 ) return (char *)s1; } return NULL;}