C语言strstr函数
函数strstr定义: char *strstr(const char *str1, const char *str2);位于头文件“string.h”中。作用:strstr函数用于判断字符串str2是否为字符串str1的子串,如果是函数返回str2在str1中首次出现的地址,否则返回NULL。例如:char *ret;char str1[6]="qwerty";char str2[4]="ert";ret=strstr(str1,str2);strstr函数返回ret的值为"erty"。
原创
2021-08-24 09:56:38 ·
14836 阅读 ·
1 评论