取字符串某个特定字符后的字符串 strchr函数

strchr函数返回指定字符串中从左到右第一个指定字符的指针,未找到则返回NULL。

函数原型:extern char *strchr(char *str,char character)

例如:字符串s为(11,LL),strchr(s,',')+1所对应的字符串是‘LL)',strchr(s,',')对应的字符串是',LL)'。

程序代码:

#include
using namespace std;
int main()
{
    char s[]={"(11,LL)"};
    char *str=strchr(s,',');
    cout<
运行情况:

取字符串某个特定字符后的字符串 strchr函数_第1张图片

你可能感兴趣的:(函数)