I would be tempted to use good old std::strspn like this:
bool containsOnlyAllowedSymbols(const char* equation)
{
return std::strspn(equation, "0123456789+-*/()[]{}") == std::strlen(equation);
}
5
solved function for checking if a char array contains only allowed chars [closed]