string length()

#include <set>
std::set<std::string> setName;
int main()
{
    std::string strName = "世界英雄aa";//中文占两个字节,英文占一个字节
    const char* name = strName.c_str();
    int length = strName.length();//10
    length = strlen(name);//10
    return 0;
}

 

posted @ 2015-09-27 17:03  zzyoucan  阅读(218)  评论(0编辑  收藏  举报