Compare QString With integers???
Can Someone guide me how can i compare a QString with integers .
Somthing like :
str has some number , then how do i check if it falls in certain range???
You may use QRegExp for checking. An example is given in "this post":http://qt-project.org/forums/viewthread/5736/#34201 for integer range of 0-255 as in IP addresses. However, you have to answer the question for yourself if it is worth the effort. An alternative may the conversion to integer and an integer comparison. Especially for more complicated things it might be better.
I used QString::toInt() and it really worked for me :)
Don't forget to check for the bool output of toInt(), to ensure that you really are getting an integer from your string.
Also, please mark the thread as solved if it is all good for you :)