如何获取c ++中unicode字符的十进制值
问题描述:
对于我的一个开源项目,我需要计算一个给定unicode字符的十进制等价。
For one of my opensource projects, i need to compute the decimal equivalent of a given unicode character.
例如如果tamil字符 L 'அ'
,输出应为2949。
For example if tamil character L'அ'
is given, the output should be 2949 .
我在Qt环境中使用c ++。我google了,找不到一个解决方案。如果您知道此解决方案,请帮助。
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.
答
使用 QChar 对象(您可以使用)获取 / com / 4.4 / qchar.html#unicode-2> unicode如果 QString
是您必须开始的,则
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).