I have a QString
in my sources.
So I need to convert it to integer without \"Kb\".
I tried Abcd.toInt()
but it does not work
As a suggestion, you also can use the QChar::digitValue()
to obtain the numeric value of the digit. For example:
for (int var = 0; var < myString.length(); ++var) {
bool ok;
if (myString.at(var).isDigit()){
int digit = myString.at(var).digitValue();
//DO SOMETHING HERE WITH THE DIGIT
}
}
Source: Converting one element from a QString to int