check if alphanumeric c++ code example
Example 1: c++ check if string contains non alphanumeric
#include <algorithm>
any_of(str.begin(), str.end(), [](const char& c) -> bool { return !isalnum(c); });
Example 2: c++ isalphanum
string test = "Ab4 :";
std::isalnum(test[0]); //true
std::isalnum(test[1]); //true
std::isalnum(test[2]); //true
std::isalnum(test[3]); //false
std::isalnum(test[4]); //false