Skip to content

Instantly share code, notes, and snippets.

@noodles-v6
Created November 6, 2012 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noodles-v6/4024149 to your computer and use it in GitHub Desktop.
Save noodles-v6/4024149 to your computer and use it in GitHub Desktop.
判断字符串是否数字类型
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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment