Answers for "howt o check if a string is a number in c++"

C++
6

c++ is string a number

bool isStringNumber(string str){
for(int i=0;i<str.length();i++){
if(str[i]<'0'||str[i]>'9'){
return false;
}
}
return true; 
}
//Beleive in Allah!
//just my slogan
Posted by: Guest on December-21-2020
0

c++ function for checking if a sting is a number

bool is_number(const std::string& s)
{
    std::string::const_iterator it = s.begin();
    while (it != s.end() && std::isdigit(*it)) ++it;
    return !s.empty() && it == s.end();
}
Posted by: Guest on October-21-2021

Code answers related to "howt o check if a string is a number in c++"

Browse Popular Code Answers by Language