#include <string>
#include <locale>
#include <codecvt>
std::string w2s(const std::wstring& var)
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.to_bytes(var);
}
std::wstring s2w(const std::string& var)
{
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return converter.from_bytes(var);
}
w2s转字符串s2w
于 2025-04-24 09:18:17 首次发布