摘要:
using namespace std;1、字符串中不含有汉字|--string-->wstringstring s("abc");wstring ws(s.begin(), s.end());//或者wstring ws; ws.assign(s.begin(), s.end());|--wstring-->stringwstring ws(L"ABC");string s(ws.begin(), ws.end());//或者string s; s.assign(ws.begin(), ws.end());2、字符串中含有汉字|--Wind 阅读全文
摘要:
摘自:stackoverflowstring? wstring?std::string is a basic_string templated on a char, and std::wstring on a wchar_t.char vs. wchar_tchar is supposed to hold a character, usually a 1-byte character. wchar_t is supposed to hold a wide character, and then, things get tricky: On Linux, a wchar_t is 4-bytes 阅读全文