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

别说谁变了你拦得住时间么 提交于 2019-12-19 10:23:12

问题


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 find a solution for this. Please help if you know a solution for this.


回答1:


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




回答2:


cout << (int)c 

that's it




回答3:


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


来源:https://stackoverflow.com/questions/2714154/how-to-get-decimal-value-of-a-unicode-character-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!