Character
Typing
isxxxxx
Syntax
#include
<ctype.h>
int
isalnum(c)
char
c;
int
isalpha(c)
char
c;
int
isascii(c)
char
c;
int
iscntrl(c)
char
c;
int
isdigit(c)
char
c;
int
isgraph(c)
char
c;
int
islower(c)
char
c;
int
isprint(c)
char
c;
int
ispunct(c)
char
c;
int
isspace(c)
char
c;
int
isupper(c)
char
c;
int
isxdigit(c}
char
c;
Defined
in
isxxx.c
and
ctype.c
in
rts.src
Also defined in
ctype.
h
as
macros
Description
These functions test a single argument c to
see
if it is a particular type
of
character - alphabetic, alphanumeric, numeric, ASCII, etc.
If
the test
is
true
(the character
is
the type
of
character that
it
was tested
to
be), the function
returns a nonzero value;
if
the test
is
false, the function returns
O.
The
character typing functions include:
isalnum.
identifies alphanumeric ASCII characters (tests for any character
isalpha
isascii
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
for which isalpha or isdigit
is
true).
identifies alphabetic ASCII characters (tests for any character for
which islower or isupper
is
true).
identifies ASCII characters (any character between
0-127).
identifies control characters (ASCII character 0-31 and
127).
identifies numeric characters
('0'
-
'9')
identifies any non -space character.
identifies lowercase alphabetic ASCII characters.
identifies printable ASCII characters, including spaces (ASCII
characters
32-126).
identifies ASCII punctuation characters.
identifies
ASCII spacebar, tab (horizontal or vertical), carriage
return, formfeed, and
newline characters.
identifies uppercase ASCII alphabetic characters.
identifies hexadecimal digits (0-9, a-f, A-F).
The
C compiler also supports a set
of
macros that perform these same
functions. The macros have the same names
as
the functions, but
are
pre-
fixed
with
an
underscore; for example, -isascii
is
the macro equivalent
of
the isascii function. In general, the macros execute more efficiently than the
functions.
6-43