Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active June 30, 2024 14:22
Show Gist options
  • Save trikitrok/87cbd99c4358f31776f7 to your computer and use it in GitHub Desktop.
Save trikitrok/87cbd99c4358f31776f7 to your computer and use it in GitHub Desktop.
std::vector<std::string> NumbersExtractor::filterOutNotNumericTokens(const std::vector<std::string> & tokens) const {
std::vector<std::string> numericTokens;
for (unsigned int i = 0; i < tokens.size(); ++i) {
std::string token = tokens[i];
if (isNotAnInteger(token)) {
continue;
}
numericTokens.push_back(tokens[i]);
return numericTokens;
}
bool NumbersExtractor::isNotAnInteger(const std::string & str) const {
return ! StringUtils::isAnInteger(str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment