Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
得到char*中中文的个数 - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


char*怎样存储中文 http://www.huidong.xyz/?mode=2&id=96


中文表示为负数,则依此进行判断中文的个数


/*
    GetCHSNum
    得到char*中中文的个数
    
    pchar    原字符串
    返回值    中文个数
\*/
int GetCHSNum(char pchar[])
{
    int num = 0;

    for (unsigned int i = 0; i < strlen(pchar); i++)
    {
        if (pchar[i] < 0)
        {
            num++;
            i++;
        }
    }

    return num;
}






返回首页


Copyright (C) 2018-2024 huidong