Node: Characters, Next: , Previous: Symbols, Up: Standard Procedures



Characters

The following table gives the list of allowed character names with their ASCII eqivalent expressed in octal.

name value alternate name name value alternate name
nul 000 null soh 001
stx 002 etx 003
eot 004 enq 005
ack 006 bel 007 bell
bs 010 backspace ht 011 tab
nl 012 newline vt 013
np 014 page cr 015 return
so 016 si 017
dle 020 dc1 021
dc2 022 dc3 023
dc4 024 nak 025
syn 026 etb 027
can 030 em 031
sub 032 esc 033 escape
fs 034 gs 035
rs 036 us 037

char? obj R5RS
Returns #t if obj is a character, otherwise returns #f.

char=? char1 char2 R5RS
char<? char1 char2 R5RS
char>? char1 char2 R5RS
char<=? char1 char2 R5RS
char>=? char1 char2 R5RS
These procedures impose a total ordering on the set of characters. It is guaranteed that under this ordering:
  • The upper case characters are in order.
  • The lower case characters are in order.
  • The digits are in order.
  • Either all the digits precede all the upper case letters, or vice versa.
  • Either all the digits precede all the lower case letters, or vice versa.

char-ci=? char1 char2 R5RS
char-ci<? char1 char2 R5RS
char-ci>? char1 char2 R5RS
char-ci<=? char1 char2 R5RS
char-ci>=? char1 char2 R5RS
These procedures are similar to char=? et cetera, but they treat upper case and lower case letters as the same. For example, (char-ci=? #\A #\a) returns #t.

char-alphabetic? char R5RS
char-numeric? char R5RS
char-whitespace? char R5RS
char-upper-case? letter R5RS
char-lower-case? letter R5RS
These procedures return #t if their arguments are alphabetic, numeric, whitespace, upper case, or lower case characters, respectively, otherwise they return #f. The following remarks, which are specific to the ASCII character set, are intended only as a guide: The alphabetic characters are the 52 upper and lower case letters. The numeric characters are the ten decimal digits. The whitespace characters are space, tab, line feed, form feed, and carriage return.

char->integer char R5RS
integer->char n R5RS
Given a character, char->integer returns an exact integer representation of the character. Given an exact integer that is the image of a character under char->integer, integer->char returns that character. These procedures implement order-preserving isomorphisms between the set of characters under the char<=? ordering and some subset of the integers under the <= ordering. That is, if
             (char<=? a b) => #t  and  (<= x y) => #t
          
and x and y are in the domain of integer->char, then
             (<= (char->integer a)
                 (char->integer b))         =>  #t
          
            (char<=? (integer->char x)
                     (integer->char y))     =>  #t
          

char-upcase char R5RS
char-downcase char R5RS
These procedures return a character char2 such that (char-ci=? char char2). In addition, if char is alphabetic, then the result of char-upcase is upper case and the result of char-downcase is lower case.