C strstr() 函数

包含文件:string.h
函数名: strstr
函数原型:extern char *strstr(const char *str1, const char *str2);
语法:* strstr(str1,str2)
str1: 被查找目标 string expression to search.
str2: 要查找对象 The string expression to find.
返回值:该函数返回str2第一次在str1中的位置,如果没有找到,返回NULL
The strstr() function returns the ordinal position within str1 of the first occurrence of str2. If str2 is not found in str1, strstr() returns 0.
 
例子:
charstr[]="1234xyz";
char*str1=strstr(str,"34");
cout<<str1<<endl;

显示: 34 xyz

具体可以参考:http://baike.baidu.com/view/745156.htm?fr=aladdin#2

原文地址:https://www.cnblogs.com/lanye/p/3736303.html