Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stdio(3S)

ascii(7)

ctype(3)

CTYPE(3V)  —  UNKNOWN SECTION OF THE MANUAL

NAME

ctype, isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, iscntrl, isascii, isgraph, toupper, tolower, toascii,  _toupper, _tolower − 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 AND FUNCTIONS

toupper and tolower are functions, rather than macros, and work correctly on all characters.  The macros _toupper and _tolower are faster than the equivalent functions (toupper and tolower) but only work properly on a restricted range of characters.

These functions perform simple conversions on single characters. 

toupper(c) converts c to its upper-case equivalent.  If c is not a lower-case letter, it is returned unchanged. 

tolower(c) converts c to its lower-case equivalent.  If c is not an upper-case letter, it is returned unchanged. 

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

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).

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(3)

Sun Release 3.2  —  Last change: 15 April 1986

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