How to determine if a string is a number with C++?
The most efficient way would be just to iterate over the string until you find a non-digit character. If there are any non-digit characters, you can consider the string not a number. Or if you want to do it the C++11 way: As pointed out in the comments below, this only works for positive integers. … Read more