Previous: , Up: Numbers   [Contents][Index]


5.4.11 Characters

In Librep characters are stored in integers. Their read syntax is a question mark followed by the character itself, which may be an escape sequence introduced by a backslash. For details of the available escape sequences see Strings.

?a
    ⇒ 97

?\n
    ⇒ 10

?\177
    ⇒ 127

;; Also special escape syntaxes only for character, not for string.
#\newline
    ⇒ 10  ; = ?\n
;; also #\backspace, #\tab, #\linefeed, #\return, #\page, 
;; #\space, and #\rubout are available.

#\s
    ⇒ 115  ; = ?s
;; Other than above cases, the first character is read.

Functions below makes sence for ascii characters only.

Function: alpha-char-p character

This function returns true when character is one of the alphabetic characters.

(alpha-char-p ?a)
    ⇒ t
Function: upper-case-p character

When character is one of the upper-case characters this function returns true.

Function: lower-case-p character

Returns true when character is lower-case.

Function: digit-char-p character

This function returns true when character is one of the decimal digit characters.

Function: alphanumericp character

This function returns true when character is either an alphabetic character or a decimal digit character.

Function: space-char-p character

Returns true when character is a white-space character (space, tab, newline or form feed).

Function: char-upcase character

This function returns the upper-case equivalent of character. If character is already upper-case or has no upper-case equivalent it is returned unchanged.

(char-upcase ?a)
    ⇒ 65                       ;`A'

(char-upcase ?A)
    ⇒ 65                       ;`A'

(char-upcase ?!)
    ⇒ 33                       ;`!'
Function: char-downcase character

Returns the lower-case equivalent of the character character.


Previous: , Up: Numbers   [Contents][Index]