The terminating '\0' characters are not compared.
The strcasestr() function is like strstr(), but ignores the case of both arguments.
* RETURN VALUE
These functions return a pointer to the beginning of the substring, or NULL if the substring is not found.
*/
char *pRetval = strstr( (char *)pSrc, pDst);
printf("[%s]-[%d] pRetval = %s \n", __func__, __LINE__, pRetval);
/* 个人理解: 在源字符串中需找目标字符串,如果源字符串中存在,
则返回出现目标字符串的首地址,不存在,则返回空
对大小写字母敏感(区分大小写)*/
pRetval = strcasestr( (char *)pSrc, pDst );
printf("[%s]-[%d] pRetval = %s \n", __func__, __LINE__, pRetval);
/* 个人理解: 在源字符串中需找目标字符串,如果源字符串中存在,
则返回出现目标字符串的首地址,不存在,则返回空
对大小写字母不敏感(忽略大小写)*/
return 0;
}
3 strchr strrchr,
在字符串中查找对应ASCII码为对应正数的字节,前面函数返回第一次查找到,后面函数返回最后一次查找到
int main (void )
{
/* NAME
strchr, strrchr, -locate character in string
SYNOPSIS
#include <string.h>
char *strchr(const char *s, int c);
char *strrchr(const char *s, int c);
DESCRIPTION
The strchr() function returns a pointer to the first occurrence of the character c in the string s.
The strrchr() function returns a pointer to the last occurrence of the character c in the string s.
RETURN VALUE
The strchr() and strrchr() functions return a pointer to the matched character or NULL if the character is not found.
*/
const char *pSrc = "xxxxbooooobwbppppppbcccccccc";
char *pRetval = strchr((char*)pSrc, 98);
printf("[%s]-[%d] pRetval = %s \n", __func__, __LINE__, pRetval);
/* 个人理解:在目标字符串中,从字符串开头开始查找对已ASCII码为98的字节,
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-29692-4.html
幸亏市场上很多货在卖不然小米不好找借口
高铁中国在和日本竞争订单吧
这种东西还用酿吗
铁汉柔情