发布时间:2025-12-10 20:02:24 浏览次数:20
c++ stl 字符串_char*转cstring函数strchrstrrchrwcsrchr_tcsrchr字符串操作1)char*strchr(constchar*string,intc);wchar_t*wcschr(constwchar_t*string,wchar_tc);Findacharacterinastring.查找一个字符
strchr strrchr wcsrchr _tcsrchr 字符串操作
1)
char *strchr( const char*string,intc);
wchar_t*wcschr( const wchar_t*string,wchar_tc);
Find a character in a string. 查找一个字符串中首次出现的指定字符。
Return Value:Each of these functions returns a pointer to the first occurrence ofcinstring(address), or NULL ifcis not found.
(2)
char *strrchr( const char*string, intc);
char *wcsrchr( const wchar_t*string,intc);
Scan a string for the last occurrence of a character.:查找一个字符串中最后出现的指定字符。
Return Value:Each of these functions returns a pointer to the last occurrence ofcinstring(address), or NULL ifcis not found.
找出字符串中最后一个出现查找字符的地址,然后将该字符出现的地址返回。
附上源代码:
[cpp]