Shlomo Zalman Heigh
Shlomo Zalman Heigh

Reputation: 3978

Get Hex Value of UChar in ICU4C

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).

Upvotes: 1

Views: 163

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409166

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.

Upvotes: 2

Related Questions