Fundamentals of CS I (CS151 2001S) : Reference

char->integer - determine the collating sequence number of a character

Procedurechar->integer
Parametersc, a character
PurposeDetermines the collating sequence number of a character.
Producesi integer that corresponds to the sequence number of c.
PreconditionsOnly one parameter (verified).
c is a character (verified).
PostconditionsThe result is an integer.
(integer->char i) is c.
Examples
> (char->integer #\t)
116
> (char->integer #\u)
117
> (char->integer #\T)
84
> (char->integer #\?)
63
> (char->integer 4)
char->integer: expects argument of type <character>; given 4
> (integer->char (+ (char->integer #\a) 2))
#\c
> (integer->char (+ (char->integer #\A) 2))
#\C
See Also
  integer->char

Disclaimer: I usually create these pages on the fly. This means that they are rarely proofread and may contain bad grammar and incorrect details. It also means that I may update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This page was generated by Siteweaver on Thu Feb 22 05:47:49 2001.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2001S/char-to-integer.html.
You may validate this page's HTML.
The source was last modified Sun Feb 4 10:21:11 2001.