Scheme Programmer's Manual
char->integer, integer->char - conversion between characters and integers
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
Given a Unicode character,
returns an exact integer between 0 and #xD7FF or between
#xE000 and #x10FFFF which is equal to the Unicode scalar
value of that character.
must be a Unicode scalar value, i.e., a non-negative exact integer
object in [0, #xD7FF] ∪ [#xE000, #x10FFFF]. For a Unicode scalar value
returns its associated character.
Given an exact integer that is the value
returned by a character when
is applied to it,
returns that character.
Given a non-Unicode character, it returns an exact integer greater
than #x10FFFF. This is true independent of whether the
implementation uses the Unicode representation internally.
Returns a single integer and character object, respectively.
(char->integer (integer->char 5000))
=> &assertion exception ;R6RS
R6RS defines these procedures in terms of Unicode scalar values. R7RS
allows an implementation to support additional characters, and to omit
support for some Unicode characters. R5RS defines these procedures so
that char<=? on characters matches <= on the corresponding
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.
The assertions described above are errors.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
Return to Main Contents
- RETURN VALUES
- SEE ALSO