开发者

How to get decimal value of a unicode character in c++

开发者 https://www.devze.com 2022-12-28 09:38 出处:网络
For one of my opensource projects, i need to compute the decimal equivalent of a given unicode character.

For one of my opensource projects, i need to compute the decimal equivalent of a given unicode character.

For example if tamil character L'அ' is given, the output should be 2949 .

I am using c++ in Qt environment. I googled and could not f开发者_C百科ind a solution for this. Please help if you know a solution for this.


Use the unicode() method of the QChar object (which you can get e.g. with the at method of a QString, if a QString is what you have to start with).


cout << (int)c 

that's it


void print_decimal(wchar_t character)
{
  std::cout << int(character);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消