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; }
#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; }