std::isalnum
Header: <cctype>
Checks if the given character is an alphanumeric character as classified by the current C locale. In the default locale, the following characters are alphanumeric:
# Declarations
int isalnum( int ch );
# Parameters
ch: character to classify
# Return value
Non-zero value if the character is an alphanumeric character, 0 otherwise.
# Notes
Like all other functions from
Similarly, they should not be directly used with standard algorithms when the iterator’s value type is char or signed char. Instead, convert the value to unsigned char first:
# Example
#include <cctype>
#include <clocale>
#include <iostream>
int main()
{
unsigned char c = '\xdf'; // German letter ß in ISO-8859-1
std::cout << "isalnum(\'\\xdf\', default C locale) returned "
<< std::boolalpha << static_cast<bool>(std::isalnum(c)) << '\n';
if (std::setlocale(LC_ALL, "de_DE.iso88591"))
std::cout << "isalnum(\'\\xdf\', ISO-8859-1 locale) returned "
<< static_cast<bool>(std::isalnum(c)) << '\n';
}