DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

ctype(S-osr5)


ctype -- character handling routines

Syntax

#include <ctype.h>

int isdigit(c); int c;

. . . int isascii(c); int c;

Description

The character classification macros listed below are defined by the <ctype.h> header file. They each return nonzero for true, zero for false.

These functions classify character-coded integer values according to the rules of the coded character set defined by character type information in the program's locale (category LC_TYPE).

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, returning zero for values above octal 0177.

In all cases the argument is an integer, the value of which must be representable as an unsigned char or must equal the value of the macro EOF. If the argument has any other value, the behavior is undefined. isascii is defined on all integer values.


isdigit
tests for the digits 0 through 9.

isxdigit
tests for any character for which isdigit is true or for the letters a through f or A through F.

islower
tests for any lowercase letter as defined by the character set.

isupper
tests for any uppercase letter as defined by the character set.

isalpha
tests for any character for which islower or isupper is true and possibly any others as defined by the character set.

isalnum
tests for any character for which isalpha or isdigit is true.

isspace
tests for a space, horizontal-tab, carriage return, newline, vertical-tab, or form-feed.

iscntrl
tests for ``control characters'' as defined by the character set.

ispunct
tests for any character other than the ones for which isalnum, iscntrl, or isspace is true.

isprint
tests for a space or any character for which isalnum or ispunct is true or other ``printing character'' as defined by the character set.

isgraph
tests for any character for which isprint is true, except for space.

isascii
tests for an ASCII character (a non-negative number less than 0200).

All the character classification macros do a table lookup.

Diagnostics

If the argument to any of the character handling macros is not in the domain of the function, the result is undefined.

Warning

If a character variable or constant is passed to these functions or macros, undefined results may occur on machines which sign-extend characters by default.

See also

ascii(M), chrtbl(M), environ(M), stdio(S-osr5), toascii(S-osr5)

Standards conformance

isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, and isxdigit are conformant with:

X/Open Portability Guide, Issue 3, 1989 ;
ANSI X3.159-1989 Programming Language -- C ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005