You are looking at historical revision 39432 of this page. It may differ significantly from its current revision.

icu

Select bindings to the ICU unicode library.

Introduction

This library is partially inspired by [https://docs.python.org/3/library/unicodedata.html|Python's unicodedata library]. As it deals with unicode, it also reexports the utf8 egg for ease of use.

Procedures

Names

[procedure] (char-from-name name)

Return char corresponding to string name name. name is passed through string-upcase.

(char-from-name "fire") ;; => #\x1f525
(char-from-name "FIRE") ;; => #\x1f525
[procedure] (char-string-name char)

Returns string name for char.

(char-string-name #\x1f525) ;; => "FIRE"

Decomposition and Normalization

[procedure] (char-decomposition char)

Returns the decomposition mapping of char.

For example, for ¼, VULGAR FRACTION ONE QUARTER:

(char-decomposition #\xBC) ;; => '(#\1 #\x2044 #\4)
[procedure] (string-normalize str [form])

Returns the normalized form of str to the destination string according to form, which can be any of "nfc", "nfkc", "nfd", or "nfkd"

(string-normalize "¼") ;; => "1/4"

Numbers

[procedure] (char-digit-value char)

Binding for u_charDigitValue. Returns the decimal digit value of a decimal digit character.

(char-digit-value #\4) ;; => 4
[procedure] (char-numeric-value char)

Binding for u_getNumericValue. Get the numeric value (as a double) for a Unicode code point as defined in the Unicode Character Database.

(char-numeric-value #\4) ;; => 4.0
(char-numeric-value #\xBC) ;; => .25
[procedure] (char-digit char radix)

Binding for u_digit. Returns the decimal digit value of the code point in the specified radix.

(char-digit #\f 16) ;; => 15
[procedure] (char-for-digit char radix)

Binding for u_forDigit. Determines the character representation for a specific digit in the specified radix.

(char-for-digit 15 16) ;; => #\f
[procedure] (char-digit? char)

Binding for u_isdigit. Determines whether the specified code point is a digit character according to Java.

[procedure] (char-xdigit? char)

Binding for u_isxdigit. Determines whether the specified code point is a hexadecimal digit.