13.3 Character Construction and Selection

These functions may be used to extract attributes of a character and to construct new characters.

[Function] char-code char

The argument char must be a character object. char-code returns the code attribute of the character object; this will be a non-negative integer less than the (normal) value of the variable char-code-limit.

This is usually what you need in order to treat a character as an index into a vector. The length of the vector should then be equal to char-code-limit. Be careful how you initialize this vector; remember that you cannot necessarily expect all non-negative integers less than char-code-limit to be valid character codes.


[Function] code-char code

Returns a character with the code attribute given by code. If no such character exists and one cannot be created, nil is returned. For example:

(char= (code-char (char-code c)) c)