C++ Language/Std/Strings/CharacterCategories
There are functions for classifying a character as belonging to a category.
The examples isdigit('0'), isspace(' '), and ispunct('!') all return true (in the form of a non-zero int value).
Additional information about character categories (includes interactive examples)