c++ 怎样获取一串字符串的字符数,不是字节数

想获取一串包括中文的字符串的字符数,请问有哪个函数可以调用.。。。。。。。。。。。。。。。

看看http://blog.csdn.net/infoworld/article/details/38119229

 #include<iostream>
using namespace std;

int main()
{ 
    int count = 0;
    char* buffer = "爱神as箭34按.实";
    while(*buffer++ != '\0')
    {
        count++;
        //当前字符是中文字符,则让指针多移一位,因为中文字符占两个字节
        if(!(*buffer >= 0 && *buffer <= 127))
            buffer++;
    }
    cout << count <<endl;
    system("pause");
}

结果:
图片说明

strlen(数组名)

一个汉字两个字符嘛,strlen就可以喽

string strTest =“tyu”;
int i =strTest .length();

strlen()