xxxxxxxxxx
if (stringVariable.find_first_not_of("0123456789.-") == std::string::npos){
return true;
}
else {
return false;
}
xxxxxxxxxx
bool is_digits(const std::string &str)
{
return std::all_of(str.begin(), str.end(), ::isdigit); // C++11
}
xxxxxxxxxx
bool isParam (string line)
{
if (isdigit(atoi(line.c_str())))
return true;
return false;
}
xxxxxxxxxx
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();
}