Quote 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:

Qt Code:
  1. QString aString("aString");
  2.  
  3. char *str = aString.ascii(); // returns a C-String
  4. int asciiVal = str[0]; // 0x61 - or just use str[0]
To copy to clipboard, switch view to plain text mode 


or:

Qt Code:
  1. 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