On this page:
alpha-char-p
char
char<
char<=
char>
char>=
char-code
char-downcase
char-equal
char-upcase
characterp
code-char
digit-char-p
digit-to-char
lower-case-p
standard-char-p
upper-case-p
Version: 4.1
2.4.4 Characters

(alpha-char-p x)  t

  x : (characterp x)

Determines whether x is an alphabetic character.

Examples:

  > (alpha-char-p #\a)

  t

  > (alpha-char-p #\3)

  ()

  > (alpha-char-p 5)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? any) on here; expected <char?>, given: 5

(char str n)  t

  str : (stringp str)

  n : (and (integerp n) (>= n 0) (< n (length str)))

Extracts the character at the nth (0-based) position in the string str.

Examples:

  > (char "hello" 0)

  #\h

  > (char "hello" 4)

  #\o

  > (char "hello" 100)

  ()

  > (char 'symbol 3)

  length: expects argument of type <proper list>; given symbol

(char< x y)  t

  x : (characterp x)

  y : (characterp y)

Determines whether the character code of x is less than that of y.

Examples:

  > (char< #\a #\b)

  t

  > (char< #\b #\a)

  ()

  > (char< #\b #\b)

  ()

  > (char< #\A #\a)

  t

  > (char< 5 10)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? char? any) on here; expected <char?>,

  given: 5

(char<= x y)  t

  x : (characterp x)

  y : (characterp y)

Determines whether the character code of x is less than or equal to that of y.

Examples:

  > (char<= #\a #\b)

  t

  > (char<= #\b #\a)

  ()

  > (char<= #\b #\b)

  t

  > (char<= #\A #\a)

  t

  > (char<= 5 10)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? char? any) on here; expected <char?>,

  given: 5

(char> x y)  t

  x : (characterp x)

  y : (characterp y)

Determines whether the character code of x is greater than that of y.

Examples:

  > (char> #\a #\b)

  ()

  > (char> #\b #\a)

  t

  > (char> #\b #\b)

  ()

  > (char> #\A #\a)

  ()

  > (char> 5 10)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? char? any) on here; expected <char?>,

  given: 5

(char>= x y)  t

  x : (characterp x)

  y : (characterp y)

Determines whether the character code of x is greater than or equal to that of y.

Examples:

  > (char>= #\a #\b)

  ()

  > (char>= #\b #\a)

  t

  > (char>= #\b #\b)

  t

  > (char>= #\A #\a)

  ()

  > (char>= 5 10)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? char? any) on here; expected <char?>,

  given: 5

(char-code char)  t

  char : (characterp char)

Returns the numeric code for the given character.

Examples:

  > (char-code #\a)

  97

  > (char-code #\Z)

  90

  > (char-code 'symbol)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? any) on here; expected <char?>, given:

  symbol

(char-downcase char)  t

  char : (and (characterp char) (standard-char-p str))

Converts the given character to lowercase

Examples:

  > (char-downcase #\A)

  #\a

  > (char-downcase #\a)

  #\a

  > (char-downcase 'symbol)

  char-downcase: expects argument of type <character>; given

  symbol

(char-equal x y)  t

  x : (and (characterp x) (standard-char-p x))

  y : (and (characterp y) (standard-char-p y))

Checks if the given characters are equal, ignoring to case.

Examples:

  > (char-equal #\a #\a)

  t

  > (char-equal #\A #\a)

  t

  > (char-equal 'a #\a)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? char? any) on here; expected <char?>,

  given: a

(char-upcase char)  t

  char : (and (characterp char) (standard-char-p str))

Converts the given character to uppercase

Examples:

  > (char-upcase #\A)

  #\A

  > (char-upcase #\a)

  #\A

  > (char-upcase 'symbol)

  char-upcase: expects argument of type <character>; given

  symbol

(characterp x)

Examples:

  > (characterp #\a)

  t

  > (characterp "a")

  ()

(code-char x)  t

  x : (and (integerp x) (>= x 0) (< x 256))

Converts the given number into its character equivalent.

Examples:

  > (code-char 0)

  #\nul

  > (code-char 97)

  #\a

  > (code-char 255)

  #\ÿ

  > (code-char 1000)

  #\Ϩ

  > (code-char #\5)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> integer? any) on here; expected <integer?>,

  given: #\5

(digit-char-p x)  t

  x : (characterp x)

Determines whether the given character represents a numerical digit.

Examples:

  > (digit-char-p #\3)

  3

  > (digit-char-p #\a)

  ()

  > (digit-char-p 'symbol)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/primitive-procedures/acl2-prims-scheme.scm:38:28:

  Dracula program broke the contract (case-> (-> char?

  any) (-> char? (integer-in 2 36) any)) on here; expected

  <char?>, given: symbol

(digit-to-char n)  t

  n : (and (integerp n) (<= 0 n) (>= 15 n))

Converts the given number into its equivalent character in hex notation.

Examples:

  > (digit-to-char 7)

  #\7

  > (digit-to-char 10)

  #\A

  > (digit-to-char 15)

  #\F

  > (digit-to-char #\7)

  number->string: expects type <number> as 1st argument,

  given: #\7; other arguments were: 16

(lower-case-p [x (and (characterp x) (standard-char-p x))])

#<procedure:t>Determines if x is a lowercase alphabetic character.

Examples:

  > (lower-case-p #\a)

  t

  > (lower-case-p #\A)

  ()

  > (lower-case-p 5)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? any) on here; expected <char?>, given: 5

(standard-char-p x)  t

  x : (characterp x)

Checks if the given character is a member of the *standard-chars*. This includes the standard punctuation and alphanumeric characters, along with #\newline and #\space.

Examples:

  > (standard-char-p #\a)

  reference to undefined identifier: standard-char-p

  > (standard-char-p #\5)

  reference to undefined identifier: standard-char-p

  > (standard-char-p 5)

  reference to undefined identifier: standard-char-p

(upper-case-p x)  t

  x : (and (characterp x) (standard-char-p x))

Determines if x is an upper-case alphabetic character.

Examples:

  > (upper-case-p #\A)

  t

  > (upper-case-p #\a)

  ()

  > (upper-case-p 5)

  /Volumes/Maldis/Users/cce/plt/research/dracula/release/src/l

  anguage/checking-proc.scm:36:21: Dracula program broke the

  contract (-> char? any) on here; expected <char?>, given: 5