| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#\charname
When the reader reads #\, it fetches a sbusequent character.
If it is one of ()[]{}" \|;#, this is a character literal of itself.
Otherwise, the reader reads subsequent characters until it sees
a non word-constituent character. If only one character is read,
it is the character. Otherwise, the reader matches the read characters
with predefined character names. If it doesn't match any, an error
is signalled.
The following character names are recognized. These haracter names are case insensitive.
space
newline, nl, lf
return, cr
tab, ht
page
escape, esc
delete, del
null
xN
uN
gauche.charconv module to convert Unicode
to the internal character code. Note that the specified character
may not be defined in the internal encoding; in which case, either
a substitution character is used, or an error is signalled.
#\newline => #\newline ; newline character #\x0a => #\newline ; ditto #\x41 => #\A ; ASCII letter 'A' #\u0041 => #\A ; ASCII letter 'A', specified by UCS #\u3042 => ; Hiragana letter A, specified by UCS #\u0002a6b2 => ; JISX0213 Kanji 2-94-86, specified by UCS4 |
You can denote multibyte characters with this syntax if the program text is written in the same encoding as the internal character encoding.
#t if obj is a character, #f otherwise.
=? char1 char2
<? char1 char2
<=? char1 char2
>? char1 char2
>=? char1 char2
=? char1 char2
<? char1 char2
<=? char1 char2
>? char1 char2
>=? char1 char2
[A-Za-z]), a numeric character ([0-9]), a whitespace
character, an upper case character or a lower case character, respectively.
Currently, these procedures works only for ASCII characters. They
return #f for all other characters.
char->integer returns an exact integer that represents
internal encoding of the character char.
integer->char returns a character whose internal encoding
is an exact integer n. The following expression is always
true for valid charcter char:
(eq? char (integer->char (char->integer char))) |
The result is undefined if you pass n to integer->char
that doesn't have a corresponding character.
If Gauche is compiled with UTF-8 encoding, these procedures are the
same as char->integer and integer->char.
When Gauche's internal encoding differs from UTF-8, these procedures
implicitly loads gauche.charconv module to convert internal
character code to UCS or vice versa (See section 9.2 gauche.charconv - Character Code Conversion).
If char doesn't have corresponding UCS codepoint,
char->ucs returns #f. If UCS codepoint n can't
be represented in the internal character encoding, ucs->char
returns #f, unless the conversion routine provides a substitution
character.
char itself is returned.
In the current version, character cases are not well defined outside the ASCII character range.
#f is returned.
(digit->integer #\4) => 4 (digit->integer #\e 16) => 14 (digit->integer #\9 8) => #f |
digit-char-p.
digit->integer. Returns a character that
represents the number integer in the radix radix system.
If integer is out of the valid range, #f is returned.
(integer->digit 13 16) => #\d (integer->digit 10) => #f |
digit-char.
euc-jp
utf-8
sjis
none
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |