
Originally Posted by
jacek
QString:

perator[] returns QChar which has an isDigit() method.
Right. But that just returns a boolean indicating whether it's a digit or not.
Here's one way:
char *str = aString.ascii(); // returns a C-String
int asciiVal = str[0]; // 0x61 - or just use str[0]
QString aString("aString");
char *str = aString.ascii(); // returns a C-String
int asciiVal = str[0]; // 0x61 - or just use str[0]
To copy to clipboard, switch view to plain text mode
or:
asciiVal = aString[0].latin1(); // 0x61
asciiVal = aString[0].latin1(); // 0x61
To copy to clipboard, switch view to plain text mode
In the latter, an index operation on aString returns a QChar, which as a 'latin1' accessor to the latin1 value (latin1 & ascii the same on the first 128 index range).
rickb
Bookmarks