Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #function #checking #sting #number
ADD COMMENT
Topic
Name
1+5 =