函数原型:
extern
char
*
strstr
(
char
*str1,
const
char
*str2);
语法:
*
strstr
(str1,str2)
参数:
str1: 被查找目标 string expression to search.
str2: 要查找对象 The string expression to find.
返回值:若str2是str1的子串,则返回str2在str1的首次出现的地址;如果str2不是str1的子串,则返回NULL。
例子:
char
str[]=
"1234xyz"
;
char
*str1=
strstr
(str,
"34"
);
cout << str1 << endl;
显示的是: 34xyz