ztcl::text

ztcl::text subcommand ?arg ...?

Cuts a string into grapheme clusters, words, or sentences by the rules of Unicode 18.0.0 (UAX #29), and gives its display width in columns (UAX #11 and UTS #51). Load it with package require ztcl::text.

This page also has ztcl::text::graphemes, ztcl::text::words, ztcl::text::sentences, ztcl::text::width, ztcl::text::bounds.

Subcommands

Synopsis What it does
graphemes STRING The list of the grapheme clusters: the characters that a user sees, such as an emoji with a skin tone or a letter with accents.
words ?-all? STRING The list of the word segments that have a letter or a number. With -all, each segment, so join of the list gives the string again.
sentences STRING The list of the sentences, each with its spaces and line end.
`width ?-ambiguous narrow wide? STRING`
`bounds ?-unit grapheme word

Examples

A click on an example runs it in the shell of the page.

Facts