<<< Characters | Index | Formatted Input >>> |
When using character input, you often need one or more of character classification routines from <cctype> header:
isspace(c); // is c whitespace? (' ', '\t', '\n', etc.) isalpha(c); // is c a letter? ('a'..'z', 'A'..'Z') note: not '_' isdigit(c); // is c a decimal digit? ('0'..'9') isxdigit(c); // is c hexadecimal digit: decimal digit or 'a'..'f' or 'A'..'F' isupper(c); // is c an upper-case letter? islower(c); // is c a lower-case letter? isalnum(c); // is c a letter or a decimal digit? iscntrl(c); // is c a control character (ACSII 0..31 and 127) ispunct(c); // is c not a letter, digit, whitespace, or invisible control character isprint(c); // is c printable (ASCIII ' '..'~') isgraph(c); // is c isalpha()|isdigit()|ispunct() (note, not space) toupper(c); // c or c's upper case equivalent tolower(c); // c or c's lower case equivalent
<<< Characters | Index | Formatted Input >>> |