Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

conv(3)

setlocale(3)

stdio(3s)

environ(5int)

ascii(7)

ctype(3)

Name

isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace, ispunct, isprint, isgraph, iscntrl, isascii − character classification macros

Syntax

#include <ctype.h>

int isalpha (c)

int c;

Description

These macros classify character-coded integer values according to the rules of the coded character set (codeset) identified by the last successful call to setlocale category LC_CTYPE. All macros return non-zero for true and zero for false.

If setlocale category LC_CTYPE has not been called successfully, or if character classification information is not available for a supported language, then characters are classified according to the rules of the ASCII 7-bit coded character set, returning 0 for values above octal 0177.

The macro isascii provides a result for all integer values. The rest provide a result for EOF and values in the character range of the codeset identified by the last successful call to setlocale category LC_CTYPE.

isalpha c is a letter

isupper c is an uppercase letter

islower c is a lowercase letter

isdigit c is a digit

isxdigit c is a hexadecimal digit, by default [0-9], [A-F], or [a-f]

isalnum c is an alphanumeric character

isspace c is a space, tab, carriage return, new line, or form feed

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

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

isgraph c is a printing character, like isprint except false for space

iscntrl c is a delete character (0177) or ordinary control character (less than 040) except for space characters

isascii c is an ASCII character, code less than 0200

International Environment

LC_CTYPEIf this environment variable is set and valid, ctype uses the international language database named in the definition to determine character classification rules.

LANGIf this environment variable is set and valid, ctype uses the international language database named in the definition to determine the character classification rules. If LC_CTYPE is defined, that definition supercedes the definition of LANG.

See Also

conv(3), setlocale(3), stdio(3s), environ(5int), ascii(7)
Guide to Developing International Software

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