ToInt() doesn't work...
-
Hello
I'm reading a string that contains a number and a "Z" letter. I'm removing the "Z" and converting the string to int...But it doesnt work...@milliSec = milliSec.remove(QChar('Z'), Qt::CaseSensitive);
qDebug() << "MILLISECONDS1: " << milliSec;
milliSec = milliSec.toInt();
qDebug() << "MILLISECONDS2: " << milliSec;@MILLISECONDS1 print the number correctly, but 2 doesn't (string 456375Z):
MILLISECONDS2: "456375"
MILLISECONDS2: "·"Any suggestions? Thanks
Richard -
Are you sure youve named your variables correct?
Your string and int seem to have the same name...try this
@ milliSec = milliSec.remove(QChar('Z'), Qt::CaseSensitive);
qDebug() << "MILLISECONDS1: " << milliSec;
int result(milliSec.toInt());
qDebug() << "Int Value: " << result;@ -
Of which type is milliSec?