/*
The strchr() and strrchr() functions return a pointer to the matched character or NULL
if the character is not found.
*/
char *strchr_r(const char *str, int c)
{
if(!str)
return NULL;
char ch = (char)c;
while((*str) && ((*str) != ch))
str++;
if((*str) == ch)
return (char *)str;
return NULL;
}
字符串 操作函数 strchr 实现
最新推荐文章于 2024-07-03 14:41:27 发布