Unicode.GraphemeClusterBreak (Unicode v1.21.0)

View Source

Functions to introspect Unicode grapheme cluster breaks for binaries (Strings) and codepoints.

Summary

Functions

Returns a map of aliases for Unicode grapheme cluster breaks.

Returns the count of the number of characters for a given grapheme cluster break.

Returns the Unicode ranges for a given grapheme cluster break as a list of ranges as 2-tuples.

Returns the Unicode ranges for a given grapheme cluster break as a list of ranges as 2-tuples.

Returns the grapheme cluster break name(s) for the given binary or codepoint.

Returns the map of Unicode grapheme cluster breaks.

Returns a list of known Unicode grapheme cluster break names.

Functions

aliases()

Returns a map of aliases for Unicode grapheme cluster breaks.

An alias is an alternative name for referring to a grapheme cluster break. Aliases are resolved by the fetch/1 and get/1 functions.

count(grapheme_break)

Returns the count of the number of characters for a given grapheme cluster break.

Example

iex> Unicode.GraphemeClusterBreak.count(:prepend)
27

fetch(grapheme_break)

Returns the Unicode ranges for a given grapheme cluster break as a list of ranges as 2-tuples.

Aliases are resolved by this function.

Returns either {:ok, range_list} or :error.

get(grapheme_break)

Returns the Unicode ranges for a given grapheme cluster break as a list of ranges as 2-tuples.

Aliases are resolved by this function.

Returns either range_list or nil.

grapheme_break(string)

Returns the grapheme cluster break name(s) for the given binary or codepoint.

In the case of a codepoint, a single grapheme cluster break name is returned.

For a binary a list of distinct grapheme cluster break names represented by the graphemes in the binary is returned.

grapheme_breaks()

Returns the map of Unicode grapheme cluster breaks.

The grapheme cluster break name is the map key and a list of codepoint ranges as tuples as the value.

known_grapheme_breaks()

Returns a list of known Unicode grapheme cluster break names.

This function does not return the names of any grapheme cluster break aliases.