Domanda

I'm working with ICU in a C++ library. How can I get the Unicode Hex value of a UChar? For example, 'a' should be equal to 0x0041 (http://www.unicode.org/charts/PDF/U0000.pdf).

È stato utile?

Soluzione

How about something simple like

std::cout << std::hex << std::setw(4) << std::setfill('0')
          << static_cast<int>('a') << '\n';

Though it prints 0061 and not 0041, which is the correct hex value for a.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top