ctype(3C) ctype(3C) NAME ctype: isdigit, isxdigit, islower, isupper, isalpha, isalnum, isspace, iscntrl, ispunct, isprint, isgraph, isascii, __isblank - character handling SYNOPSIS #include <ctype.h> int isupper(int c); int islower(int c); int isalpha(int c); int isdigit(int c); int isxdigit(int c); int isspace(int c); int ispunct(int c); int isprint(int c); int isgraph(int c); int iscntrl(int c); int __isblank(int c); int isalnum(int c); int isascii(int c); DESCRIPTION These macros classify character-coded integer values. Each is a predicate returning non-zero for true, zero for false. The behavior of these macros, except for isascii, is affected by the current locale [see setlocale(3C)]. To modify the behavior, change the LC_TYPE category in setlocale, that is, setlocale (LC_CTYPE, newlocale). In the C locale, or in a locale where character type information is not defined, characters are classified according to the rules of the US-ASCII 7-bit coded character set. The macro isascii is defined on all integer values; the rest are defined only where the argument is an int, the value of which is representable as an unsigned char, or EOF, which is defined by the stdio.h header file and represents end-of-file. isupper tests for any character that is classified as an uppercase letter. In a locale-specific character class, no character specified for the cntrl, digit, punct, or space character class can be specified as class upper character. In the C locale, the 26 uppercase letters are included in the class upper: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z islower tests for any character that is classified as a lowercase letter. In a locale-specific character class, no character specified for the cntrl, digit, punct, or space, character class can be specified as class lower character. In the C locale, the 26 lowercase letters are included in the class lower: a b c d e f g h i j k l m n o p q r s t u v w x y z isalpha tests for any character that is classified as a letter. In a locale-specific character class, no character specified for the cntrl, digit, punct, or space character class can be specified as class alpha character. Characters classified as either upper or lower class are automatically included in the class alpha. In the C locale, all characters in the classes upper and lower are included in the class alpha. isdigit tests for any character that is classified as a numeric digit. In a locale-specific character class, only the digits [0-9], in contiguous ascending sequence by numerical value, can be specified as class digit character. In the C locale, only: 0 1 2 3 4 5 6 7 8 9 are included in the class digit. isxdigit tests for any character that is classified as a hexadecimal digit. In a locale-specific character class, only the characters defined for the class digit, in contiguous ascending sequence by numerical value, followed by one or more sets of six characters representing the hexadecimal digits 10 to 15 inclusive (for example A, B, C, D, E, F, a, b, c, d, e, f), with each set in ascending order, can be specified as class xdigit character. In the C locale, only: 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f are included in the class xdigit. isspace tests for any character that is classified as a white- space character. In a locale-specific character class, no character specified for the upper, lower, alpha, digit, graph, or xdigit character class can be specified as class space character. In the C locale, the characters space, form-feed, newline, carriage-return, tab and vertical-tab are included in the class space. ispunct tests for any character that is classified as a punctuation character. In a locale-specific character class, no character specified for the upper, lower, alpha, digit, cntrl, or xdigit character class can be specified as class punct character. The space character cannot be specified as class punct character. In the C locale, neither the space character nor any characters in classes alpha, digit or cntrl are included in the class punct. isprint tests for any character that is classified as a printable character, including the space character. In a locale-specific character class, no character specified for the class cntrl can be specified as class print character. Characters specified for the classes upper, lower, alpha, digit, xdigit, punct and the space character are automatically included in the class print. In the C locale, all characters in class graph are included in the class print; no characters in class cntrl are included. isgraph tests for any character that is classified as printable character, not including the space character. In a locale-specific character class, no character specified for the class cntrl can be specified as class graph character. Characters specified for the classes upper, lower, alpha, digit, xdigit, and punct are automatically included in the class print. In the C locale, all characters in classes alpha, digit and punct are included in the class graph; no characters in class cntrl are included. iscntrl tests for any character that is classified as a control character. In a locale-specific character class, no character specified for the upper, lower, alpha, digit, punct, graph, print or xdigit character class can be specified as class cntrl character. In the C locale, no characters in classes alpha or print are included in the class cntrl. __isblank tests for any character that is classified as a blank character. In the C locale, only the space and tab characters are included in the class blank. isalnum tests for any character that is classified as a letter or a numerical digit. In a locale-specific character class, characters in the classes upper, lower, alpha, and digit are automatically classified as letters or numerical digits. isascii tests for any ASCII character, code between 0 and 0177 inclusive. All the character classification macros use a table lookup. Functions exist for all the above-defined macros. To get the function form, the macro name must be bypassed (e.g., #undef isdigit). FILES /usr/lib/locale/locale/LC_CTYPE SEE ALSO chrtbl(1M), wchrtbl(1M), ctype(3C), setlocale(3C), stdio(3S), ascii(5), environ(5). DIAGNOSTICS If the argument to any of the character handling macros is not in the domain of the function, the result is undefined. Page 4