What is the best way to tell if a QString
is made up of just numbers?
There doesn't appear to be a convenience function in the QString
library.
Do I have to iterate over every character, one at a time, or is there a more elegant way that I haven't thought of?
You could use a regular expression, like this:
QRegExp re("\\d*"); // a digit (\d), zero or more times (*)
if (re.exactMatch(somestr))
qDebug() << "all digits";