Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@thiagomg
Created December 9, 2015 13:39
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 thiagomg/5b2d06a923d1a8af6fed to your computer and use it in GitHub Desktop.
Save thiagomg/5b2d06a923d1a8af6fed to your computer and use it in GitHub Desktop.
Legibilidade com C++14 - get_numeric
std::string get_numeric(const std::string &input)
{
std::string output;
std::for_each(begin(input), end(input), [&output](const char c) {
if( c >= '0' && c <= '9' ) output.push_back(c);
});
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment