In order to port this code as-is to Qt you need to do the following (in this order):
1. learn C++;
2. learn some Qt basics;
3. have a look at the documentation for the QString and QChar classes, that you will use to represent strings and characters respectively. All the operations you need are there.

However you can probably replace all this code with a simple regular expression. Once you have done steps 1 and 2 above, you can have a look at QRegExp, which d_stranz mentioned above. The documentation of the class explains the syntax of regular expressions and gives some examples that among other things show how to match digits in a string.