CTYPE(3C)
NAME
isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, isgraph, iscntrl, isascii − classify characters
SYNOPSIS
#include <ctype.h>
int isalpha (c)
int c;
. . .
DESCRIPTION
These functions classify character-coded integer values according to the rules of the coded character set identified by the last successful call to nl_init(3C). Each function is a predicate returning non-zero for true, zero for false.
If nl_init(3C) has not been called successfully, characters are classified according to the rules of the default ASCII 7-bit coded character set (see nl_init(3C)).
Isascii is defined on all integer values; the other functions are defined for the range −1 (EOF) to 255.
isalpha c is a letter.
isupper c is an uppercase letter.
islower c is a lowercase letter.
isdigit c is a decimal digit (in ASCII: characters [0-9]).
isxdigit c is a hexadecimal digit (in ASCII: characters [0-9], [A-F] or [a-f]).
isalnum c is an alphanumeric (letters or digits).
isspace c is a character that creates "white space" in displayed text (in ASCII: space, tab, carriage return, new-line, vertical tab, and form-feed).
ispunct c is a punctuation character (in ASCII: any printing character except the space character (040), digits, letters).
isprint c is a printing character.
isgraph c is a visible character (in ASCII: printing characters, excluding the space character (040)).
iscntrl c is a control character (in ASCII: character codes less than 040 and the delete character (0177)).
isascii c is any ASCII character code between 0 and 0177, inclusive.
DIAGNOSTICS
If the argument to any of these functions is outside the domain of the function, the result is undefined.
WARNING
These functions are supplied both as library functions and as macros defined in the <ctype.h> header. Normally, the macro versions will be used. To obtain the library function either use a #undef to remove the macro definition or, if compiling in ANSI C mode, enclose the function name in parenthesis or take its address. The following example will use the library functions for isalpha, isdigit, and isspace:
#include <ctype.h>
#undef isalpha
...
main()
{
int (*ctype_func)();
...
if ( isalpha(c) )
...
if ( (isdigit)(c) )
...
ctype_func = isspace;
...
}
EXTERNAL INFLUENCES
Locale
The LC_CTYPE category determines the classification of character type.
International Code Set Support
Single-byte character code sets are supported.
AUTHOR
Ctype was developed by AT&T and HP.
SEE ALSO
STANDARDS CONFORMANCE
isalnum: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
isalpha: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
isascii: SVID2, XPG2, XPG3
iscntrl: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
isdigit: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
isgraph: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
islower: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
isprint: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
ispunct: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
isspace: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
isupper: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
isxdigit: SVID2, XPG2, XPG3, POSIX.1, FIPS 151-1, ANSI C
Hewlett-Packard Company — HP-UX Release 7.0: Sept 1989