chickadee » icu

icu

Chicken bindings to the ICU unicode library

Select bindings to the ICU unicode library.

Introduction

This library is partially inspired by Python's unicodedata library. As it deals with unicode, it also reexports the utf8 egg for ease of use.

Procedures

Names

char-from-name nameprocedure

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

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

Returns string name for char.

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

Decomposition and Normalization

char-decomposition charprocedure

Returns the decomposition mapping of char.

For example, for ¼, VULGAR FRACTION ONE QUARTER:

(char-decomposition #\xBC) ;; => '(#\1 #\x2044 #\4)
string-normalize input #!optional (form nfkc)procedure

Returns the normalized form of str to the destination string according to form

form
Any of "nfc", "nfkc", "nfd", or "nfkd"
(string-normalize "¼") ;; => "1/4"

Numbers

char-digit-value charprocedure

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

(char-digit-value #\4) ;; => 4
char-numeric-value charprocedure

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
char-digit char radixprocedure

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

(char-digit #\f 16) ;; => 15
char-for-digit char radixprocedure

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

(char-for-digit 15 16) ;; => #\f
char-digit? charprocedure

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

char-xdigit? charprocedure

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

Operators and transformers

char-mirror charprocedure

Binding for u_charMirror. Maps the specified character to a "mirror-image" character.

char-bidi-paired-bracket charprocedure

Binding for u_getBidiPairedBracket. Maps the specified character to its paired bracket character.

char->lower charprocedure
char->upper charprocedure
char->title charprocedure

Bindings for u_tolower,u_toupper, and u_totitle

Properties

char-category charprocedure

Binding for u_charType. Returns the general category value for the code point (an integer, see below).

You can convert this to a symbol with category->integer, and vice versa with integer->category

Categories:

category/unassignedconstant
category/uppercase-letterconstant
category/lowercase-letterconstant
category/titlecase-letterconstant
category/modifier-letterconstant
category/other-letterconstant
category/non-spacing-markconstant
category/enclosing-markconstant
category/combining-spacing-markconstant
category/decimal-digit-numberconstant
category/letter-numberconstant
category/other-numberconstant
category/space-separatorconstant
category/line-separatorconstant
category/paragraph-separatorconstant
category/control-charconstant
category/format-charconstant
category/private-use-charconstant
category/surrogateconstant
category/dash-punctuationconstant
category/start-punctuationconstant
category/end-punctuationconstant
category/connector-punctuationconstant
category/other-punctuationconstant
category/math-symbolconstant
category/currency-symbolconstant
category/modifier-symbolconstant
category/other-symbolconstant
category/initial-punctuationconstant
category/final-punctuationconstant
category/char-category-countconstant

char-direction charprocedure

Binding for u_charDirection. Returns the bidirectional category value for the code point, which is used in the Unicode bidirectional algorithm (an integer, see below).

You can convert this to a symbol with direction->integer, and vice versa with integer->direction.

Directions:

direction/left-to-rightconstant
direction/right-to-leftconstant
direction/european-numberconstant
direction/european-number-separatorconstant
direction/european-number-terminatorconstant
direction/arabic-numberconstant
direction/common-number-separatorconstant
direction/block-separatorconstant
direction/segment-separatorconstant
direction/white-space-neutralconstant
direction/other-neutralconstant
direction/left-to-right-embeddingconstant
direction/left-to-right-overrideconstant
direction/right-to-left-arabicconstant
direction/right-to-left-embeddingconstant
direction/right-to-left-overrideconstant
direction/pop-directional-formatconstant
direction/dir-non-spacing-markconstant
direction/boundary-neutralconstant
direction/first-strong-isolateconstant
direction/left-to-right-isolateconstant
direction/right-to-left-isolateconstant
direction/pop-directional-isolateconstant
direction/char-direction-countconstant

char-combining-class charprocedure

Binding for u_getCombiningClass. Returns the combining class of the code point as specified in UnicodeData.txt.

Predicates

char-mirrored? charprocedure
char-ualphabetic? charprocedure
char-ulowercase? charprocedure
char-uuppercase? charprocedure
char-uwhitespace? charprocedure
char-whitespace? charprocedure
char-java-space? charprocedure
char-space? charprocedure
char-blank? charprocedure
char-lower? charprocedure
char-upper? charprocedure
char-alpha? charprocedure
char-alnum? charprocedure
char-punct? charprocedure
char-graph? charprocedure
char-defined? charprocedure
char-cntrl? charprocedure
char-iso-control? charprocedure
char-print? charprocedure
char-base? charprocedure

Author

Diego A. Mundo

Repository

https://git.sr.ht/~dieggsy/icu

Version History

0.3.2
Document with chalk
0.3.1
Fix issue with utf8 reexports
0.3.0
Slight API change
0.2.0
Make string-normalize form parameter optional
0.1.0
Initial version

License

Unicode

COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)

Copyright © 1991-2020 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in https://www.unicode.org/copyright.html.

Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
(the "Data Files") or Unicode software and any associated documentation
(the "Software") to deal in the Data Files or Software
without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, and/or sell copies of
the Data Files or Software, and to permit persons to whom the Data Files
or Software are furnished to do so, provided that either
(a) this copyright and permission notice appear with all copies
of the Data Files or Software, or
(b) this copyright and permission notice appear in associated
Documentation.

THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THE DATA FILES OR SOFTWARE.

Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in these Data Files or Software without prior
written authorization of the copyright holder.

Contents »