c语言字符串的查找用什么函数

Python017

c语言字符串的查找用什么函数,第1张

用strstr这个函数

包含文件:string.h

函数名: strstr

函数原型:extern char *strstr(char *str1, char *str2)

功能:找出str2字符串在str1字符串中第一次出现的位置(不包括str2的串结束符)。

返回值:返回该位置的指针,如找不到,返回空指针。

复制相关函数:memcpy、memmove、strcpy、strncpy

字符串连接函数:strcat、strncat

字符串比较函数:memcmp、strcmp、strcoll、strncmp、strxfrm、

查找函数:memchr、strchr、strcspn、strpbrk、strrchr、strspn、strstr、strtok

其他相关函数:memset、strerror、strlen