CTYPE(2)                                                 CTYPE(2)

     NAME
          isalpha, isupper, islower, isdigit, isxdigit, isalnum,
          isspace, ispunct, isprint, isgraph, iscntrl, isascii,
          toascii, _toupper, _tolower, toupper, tolower - ASCII
          character classification

     SYNOPSIS
          #include <u.h>
          #include <libc.h>
          #include <ctype.h>

          isalpha(c)

          isupper(c)

          islower(c)

          isdigit(c)

          isxdigit(c)

          isalnum(c)

          isspace(c)

          ispunct(c)

          isprint(c)

          isgraph(c)

          iscntrl(c)

          isascii(c)

          _toupper(c)

          _tolower(c)

          toupper(c)

          tolower(c)

          toascii(c)

     DESCRIPTION
          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 is true and on the

     Page 1                       Plan 9            (printed 12/30/24)

     CTYPE(2)                                                 CTYPE(2)

          single non-ASCII value EOF; see fopen(2).

          isalpha  c is a letter, a-z or A-Z

          isupper  c is an upper case letter, A-Z

          islower  c is a lower case letter, a-z

          isdigit  c is a digit, 0-9

          isxdigit c is a hexadecimal digit, 0-9 or a-f or A-F

          isalnum  c is an alphanumeric character, a-z or A-Z or 0-9

          isspace  c is a space, horizontal tab, newline, vertical
                   tab, formfeed, or carriage return (0x20, 0x9, 0xA,
                   0xB, 0xC, 0xD)

          ispunct  c is a punctuation character (one of !"#$%&'()*+,-
                   ./:;<=>?@[\]^_`{|}~)

          isprint  c is a printing character, 0x20 (space) through
                   0x7E (tilde)

          isgraph  c is a visible printing character, 0x21 (exclama-
                   tion) through 0x7E (tilde)

          iscntrl  c is a delete character, 0x7F, or ordinary control
                   character, 0x0 through 0x1F

          isascii  c is an ASCII character, 0x0 through 0x7F

          Toascii is not a classification macro; it converts its argu-
          ment to ASCII range by anding with 0x7F.

          If c is an upper case letter, tolower returns the lower case
          version of the character; otherwise it returns the original
          character.  Toupper is similar, returning the upper case
          version of a character or the original character.  Tolower
          and toupper are functions; _tolower and _toupper are corre-
          sponding macros which should only be used when it is known
          that the argument is upper case or lower case, respectively.

     SOURCE
          /sys/include/ctype.h        for the macros.
          /sys/src/libc/port/ctype.c  for the tables.

     SEE ALSO
          isalpharune(2)

     BUGS
          These macros are ASCII-centric.

     Page 2                       Plan 9            (printed 12/30/24)