Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stdio(3S)

ascii(7)

ctype(3V)

CTYPE(3)  —  C LIBRARY FUNCTIONS

NAME

ctype, isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, iscntrl, isascii, isgraph, toupper, tolower, toascii − character classification and conversion macros and functions

SYNOPSIS

#include <ctype.h>

isalpha(c)

...

CHARACTER CLASSIFICATION MACROS

These macros classify ASCII-coded integer values by table lookup.  Each is a predicate returning nonzero for true, zero for false.  isascii is defined on all integer values; the rest are defined only where isascii(c) is true and on the single non-ASCII value EOF (see stdio(3S)).

isalpha(c) c is a letter

isupper(c) c is an upper case letter

islower(c) c is a lower case letter

isdigit(c) c is a digit [0-9]. 

isxdigit(c) c is a hexadecimal digit [0-9], [A-F], or [a-f]. 

isalnum(c)
c is an alphanumeric character, that is, c is a letter or a digit

isspace(c) c is a space, tab, carriage return, newline, vertical tab, or formfeed

ispunct(c) c is a punctuation character (neither control nor alphanumeric)

isprint(c) c is a printing character, code 040(8) (space) through 0176 (tilde)

iscntrl(c) c is a delete character (0177) or ordinary control character (less than 040). 

isascii(c) c is an ASCII character, code less than 0200

isgraph(c) c is a visible graphic character, code 041 (exclamation mark) through 0176 (tilde). 

CHARACTER CONVERSION MACROS

These macros perform simple conversions on single characters. 

toupper(c) converts c to its upper-case equivalent.  Note that this only works where c is known to be a lower-case character to start with (presumably checked via islower).

tolower(c) converts c to its lower-case equivalent.  Note that this only works where c is known to be a upper-case character to start with (presumably checked via isupper).

toascii(c) masks c with the correct value so that c is guaranteed to be an ASCII character in the range 0 thru 0x7f. 

DIAGNOSTICS

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

SEE ALSO

stdio(3S), ascii(7), ctype(3V)

Sun Release 3.2  —  Last change: 15 April 1986

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026