strstr

包含文件: string.h
函数名: strstr
函数原型:
1
extern  char  * strstr ( char  *str1,  const  char  *str2);
语法:
1
strstr (str1,str2)
str1: 被查找目标 string expression to search.
str2: 要查找对象 The string expression to find.
返回值:若str2是str1的子串,则先确定str2在str1的第一次出现的位置,并返回此str1在str2首位置的地址。;如果str2不是str1的子串,则返回NULL。
例子:
1
2
3
char  str[]= "1234xyz" ;
char  *str1= strstr (str, "34" );
cout << str1 << endl;
显示的是: 34xyz

你可能感兴趣的:(strstr)