Hi,
I use Qt C++ 5.4
Docs says I use toLatin1 instead of toAscii.
I want Ascii value of each character eg. A = 65, B=66, C=67
But result is show only Letters not Ascii ValueQString str1;
str1 ="ABCDEF"
for (int i=0; i< str1.size(); i++)
qDebug() << i << str1.mid(i,1).toLatin1() << str1.mid(i,1).toUtf8() << str.at(i).toLatin1() ;
0 "A" "A" A
1 "B" "B" B
2 "C" "C" C
3 "D" "D" D
How can I get each character's US-ASCII value of string?
I want my result as follow;
0 65
1 66
2 66
3 67
Thanks
Added after 6 minutes:
I found the solution now!.
QChar ch;
for(int i=0;i< str1.size();i++)
{
ch= s.at(i);
qDebug() << ch.unicode();
}
Bookmarks