我在 C++ 库中使用 ICU。 如何获取 UChar 的 Unicode 十六进制值?例如,'a' 应等于 0x0041 ( http://www.unicode.org/charts/PDF/U0000.pdf )。
最佳答案
像这样简单的东西怎么样
std::cout << std::hex << std::setw(4) << std::setfill('0')
<< static_cast<int>('a') << '\n';
尽管它打印出 0061
而不是 0041
,这是 a
的正确十六进制值。
关于c++ - 在 ICU4C 中获取 UChar 的十六进制值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17732544/