cctype functions
Each function below accepts a single integer argument. If the actual value is a character, C++ will convert it to its integer equivalent. Each is function returns a boolean, either true or false. The to functions return an integer which can be treated as a character.
- bool islower(int i) - returns true if chararacter represented by i is a lower case letter ('a'..'z')
- bool isupper(int i) - returns true if chararacter represented by i is an upper case letter ('A'..'Z')
- bool isalpha(int i) - returns true if islower(i) or isupper(i)
- bool isdigit(int i) - returns true if chararacter represented by i is a decimal digit ('0'..'9')
- bool isalnum(int i) - returns true if isalpha(i) or isdigit(i)
- bool iscntrl(int i) - returns true if chararacter represented by i is a control character
- bool isgraph(int i) - returns true if chararacter represented by i is any printing character except a space (' ')
- bool isprint(int i) - returns true if chararacter represented by i is any printing character including a space (' ')
- bool ispunct(int i) - returns true if chararacter represented by i is any printing character except isspace(i) and isalnum(i)
- bool isspace(int i) - returns true if chararacter represented by i is whitespace. Standard whitespace is :
- space (' ')
- formfeed ('\f')
- newline ('\n')
- carriage return ('\r')
- tab ('\t')
- vertical tab ('\v')
- bool isxdigit(int i) - returns true if chararacter represented by i is a hexadecimal digit ('0'..'9','A'..'F','a'..'f')
- int toupper(int i) - returns upper case equivalent to i if islower(i). All other values of i return i.
- int tolower(int i) - returns lower case equivalent to i if isupper(i). All other values of i return i.
a sample program using the cctype library