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

C++
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
0

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

bool isParam (string line)
{
    if (isdigit(atoi(line.c_str())))
        return true;

    return false;
}
Posted by: Guest on October-21-2021

Code answers related to "c++ function for checking if a sting is a number"

Browse Popular Code Answers by Language