Check whether a character falls into a given category.

int isalnum(char c);
int isalpha(char c);
int iscntrl(char c);
int isdigit(char c);
int isgraph(char c);
int islower(char c);
int isprint(char c);
int ispunct(char c);
int isspace(char c);
int isupper(char c);
int isxdigit(char c);

The is... functions return nonzero if the given character falls into the category, zero otherwise.

Character categories

isalnum letters (A to Z or a to z) or digits (0 to 9)
isalpha letters (A to Z or a to z)
iscntrl delete characters or ordinary control characters (0x7F or 0x00 to 0x1F)
isdigit digits (0 to 9)
isgraph printing characters (except space)
islower lowercase letters (a to z)
isprint printing characters (0x20 to 0x7E)
ispunct punctuation characters (iscntrl or isspace)
isspace space, tab, carriage return, new line, vertical tab, or formfeed (0x09 to 0x0D, 0x20)
isupper uppercase letters (A to Z)
isxdigit hex digits (0 to 9, A to F, a to f)


char c = 'A';
if (isxdigit(c))
   printf("%c is hex\n", c);
   printf("%c is not hex\n", c);

Index Copyright © 2005 CadSoft Computer GmbH