I\'ve had quite a bit of trouble trying to write a function that checks if a string is a number. For a game I am writing I just need to check if a line from the file I am r
The simplest I can think of in c++
bool isNumber(string s) { if(s.size()==0) return false; for(int i=0;i='0' && s[i]<='9')==false) { return false; } } return true; }
Working code sample: https://ideone.com/nRX51Y