标签:com mes c++ turn out std nic ace trre
资源文件在此
https://github.com/angzel/zen/blob/master/source/basic/zen-string/zen_utf8.h
只有两个函数
std::u32string UTF8ToUnicode(std::string const & utf8);
std::string UnicodeToUTF8(std::u32string const & strRes);
用法:
#include <iostream>
#include <string>
#include "zen_utf8.h"
using namespace std;
int main(int argc, const char * argv[]) {
std::string s = "你好,ABCD";
auto s32 = Zen::UTF8ToUnicode(s);
auto s_0_4 = Zen::UnicodeToUTF8(s32.substr(0, 4));
std::cout << s << " 的前4个字是:" << s_0_4 << std::endl;
return 0;
}
标签:com mes c++ turn out std nic ace trre
原文地址:https://www.cnblogs.com/leaving/p/14008805.html