我需要从a获取ASCII码QChar.
在Qt 5.2中QChar::ToAscii已被删除.
这是我的代码.我怎样才能获得ASCII码?
QString data;
int key;
key = data.at(i);
Kik*_*ohs 10
使用:
char QChar::toLatin1() const
来自doc:
返回与QChar相当的Latin-1字符,或0.这对非国际化软件非常有用.
来自Qt5.0版本
char QChar::toAscii() const
不推荐使用此功能.返回QChar的Latin-1字符值,如果字符不可表示,则返回0.
例
QString test("test");
QChar c = test.at(0);
int v_latin = c.toLatin1();
int v_ascii = c.toAscii();
qDebug() << v_latin << " " << v_ascii;
输出:
116   116
| 归档时间: | 
 | 
| 查看次数: | 22703 次 | 
| 最近记录: |