Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

code-char

code-char

type: function (subr) 
location: built-in
source file: xlstr.c 
Common LISP compatible: similar
versions: all machines

SYNTAX

(code-char <code> )
        <code>          -       a numeric expression

DESCRIPTION

The CODE-CHAR function returns a character which is the result of turning <code> expression into a character. If a <code> cannot be made into a character, NIL is returned. The range that <code> produces a valid character is 0 through 127.

EXAMPLES

(code-char 48)                          ; returns #\0
(code-char 65)                          ; returns #\A
(code-char 97)                          ; returns #\a
(code-char 91)                          ; returns #\[
(code-char 10)                          ; returns #\Newline
(code-char 128)                         ; returns NIL
(code-char 999)                         ; returns NIL

COMMON LISP COMPATIBILITY: Common LISP allows for some optional arguments in CODE-CHAR because it supports the concept of a complex character that includes not only the ASCII code value, but also fonts and bits. The bits allow for more than 8 bits per character (16 bits is especially useful in oriental languages). The fonts allow for up to 128 different fonts. This is interesting and neat stuff, however, XLISP does not support fonts and bits or the optional parameters associated with them.

NOTE: Unlike the CHAR-CODE and CHAR-INT functions, CODE-CHAR and INT-CHAR are not identical in use. CODE-CHAR accepts 0..127 for its range and then produces NIL results. INT-CHAR accepts 0..255 for its range and then produces errors.


Go to the first, previous, next, last section, table of contents.