How to get decimal value of a unicode character in

2019-02-19 17:55发布

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.

标签: c++ unicode qt4
3条回答
放荡不羁爱自由
2楼-- · 2019-02-19 18:22
void print_decimal(wchar_t character)
{
  std::cout << int(character);
}
查看更多
太酷不给撩
3楼-- · 2019-02-19 18:33

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

查看更多
一夜七次
4楼-- · 2019-02-19 18:43
cout << (int)c 

that's it

查看更多
登录 后发表回答