Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

setlocale(3C)

stdio(3S)

ascii(5)

environ(5)

CTYPE(3C)                            SysV                            CTYPE(3C)



NAME
     ctype: isalpha, isupper, islower, isdigit, isxdigit, isalnum, isspace,
     ispunct, isprint, isgraph, iscntrl, isascii, - classify characters

SYNOPSIS
     #include <ctype.h>

     int isalpha (c)
     int c;

     . . .

DESCRIPTION
     These functions test whether c is a specific type of character or digit,
     according to the following definitions:

     isalpha    c is an alphabetic character (letter)

     isupper    c is any uppercase letter as defined by the character set.

     islower    c is any lowercase letter as defined by the character set.

     isdigit    c is a digit [0-9]. The decimal digits are independent of the
                codeset in use.

     isxdigit   c is a hexadecimal digit [0-9], [A-F] or [a-f]. The
                hexadecimal digits are independent of the codeset in use.

     isalnum    c is an alphanumeric character. Alphanumeric characters are
                those for which isalpha or isdigit is true.

     isspace    c is a space, tab, carriage return, newline, vertical tab, or
                form-feed in the C locale.

     ispunct    c is any punctuation character (that is, any printing
                character except the space character (040), digits or letters
                in US-ASCII).

     isprint    c is a printing character (that is a space or any character
                for which isalnum or ispunct is true or any other "printing
                character" as defined by the character set.

     isgraph    c is any character with visible representation (e.g., printing
                characters excluding the space character (040) in ASCII).

     iscntrl    c is any "control character" defined by the character set.

     isascii    c is a US-ASCII 7-bit character.


     Character Classification
     For all ctype character-handling functions (except isascii, isdigit and
     isxdigit), the following is true:

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

     For all ctype functions, the argument is an int, the value of which must
     be represented as an unsigned char or must equal the value of the macro
     EOF (see stdio(3S)).  EOF is guaranteed not to be a character set member.
     If the argument has any other value, the behavior is undefined.

DIAGNOSTICS
     The isalpha function returns a nonzero if c is an alphabetic character;
     otherwise, it returns zero.

     The isupper function returns a nonzero if c is an uppercase character;
     otherwise, it returns zero.

     The islower function returns a nonzero if c is a lowercase character;
     otherwise, it returns zero.

     The isdigit function returns a nonzero if c is a decimal digit;
     otherwise, it returns zero.

     The isxdigit function returns a nonzero if c is a hexadecimal digit;
     otherwise, it returns zero.

     The isalnum function returns a nonzero if isalpha or isdigit would return
     zero; otherwise, it returns zero.

     The isspace function returns a nonzero if c is a whitespace character;
     otherwise, it returns zero.

     The ispunct function returns a nonzero if c is a punctuation character;
     otherwise, it returns zero.

     The isprint function returns a nonzero if c is a printing character;
     otherwise, it returns zero.

     The isgraph function returns a nonzero if c is a character with a visible
     representation; otherwise, it returns zero.

     The iscntrl function returns a nonzero if c is a control character;
     otherwise, it returns zero.

     The isascii function returns a nonzero if c is an ASCII character code
     between zero and 0177, inclusive; otherwise, it returns zero.

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

NOTES
     To be compatible with traditional C usage, have the functions defined as
     macros by adding the directive

          #define _CLASSIC_CTYPE_MACROS

     before any #include directives in your program.

SEE ALSO
     setlocale(3C), stdio(3S), ascii(5), <ctype.h>, <stdiolh>, environ(5).

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