XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

code-char


Type:   -   function (subr)
Source:   -   xlstr.c

Syntax

(code-char code)
code - a numeric expression representing the ASCII code as an integer
returns - the character with that code or NIL

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

See the code-char function in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next