std/text/unicode▲toc

Basic unicode support.

.

alias graphemestd/text/unicode/grapheme: V = stringstd/core/types/string: V

Grapheme's are an alias for stringstd/core/types/string: V. Each grapheme is a self-contained symbol consisting of a unicode character followed by combining characters and/or combining marks.

type normalizationstd/text/unicode/normalization: V

Type of unicode normalization.

con NFC

Canonical composition (default). Use composed characters when possible.

con NFD

Canonical decomposition.

con NFKC

Compatibility composition.

con NFKD

Compatibility decomposition.

fun char/width( c : charstd/core/types/char: V ) : intstd/core/types/int: V

Return the column-width of a unicode character. Equivalent to wcwidth.

fun string/width( s : stringstd/core/types/string: V ) : intstd/core/types/int: V

Return the total column-width of a string.

fun graphemes( s : stringstd/core/types/string: V ) : liststd/core/types/list: V -> V<graphemestd/text/unicode/grapheme: V>

Convert a string to a list of graphemes. Each grapheme will be in NFCstd/text/unicode/NFC: normalization normalized form.

fun is-combining( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is this a combining character?

fun normalize( s : stringstd/core/types/string: V, norm : ? normalizationstd/text/unicode/normalization: V ) : stringstd/core/types/string: V

Normalize a unicode string. If no normalization form is given, NFCstd/text/unicode/NFC: normalization is used.

private import std/core/typesstd/core/types, std/core/hndstd/core/hnd, std/core/exnstd/core/exn, std/core/boolstd/core/bool, std/core/orderstd/core/order, std/core/charstd/core/char, std/core/intstd/core/int, std/core/vectorstd/core/vector, std/core/stringstd/core/string, std/core/sslicestd/core/sslice, std/core/liststd/core/list, std/core/maybestd/core/maybe, std/core/eitherstd/core/either, std/core/tuplestd/core/tuple, std/core/showstd/core/show, std/core/debugstd/core/debug, std/core/delayedstd/core/delayed, std/core/consolestd/core/console, std/corestd/core, std/core/undivstd/core/undiv