Functions to introspect the Unicode Bidi_Paired_Bracket_Type property for binaries (Strings) and codepoints.
The Bidi_Paired_Bracket_Type property identifies the bracket pairs used by the bidirectional algorithm (see UAX #9). The values are :open and :close; all other codepoints have the value :none.
The primary API is bidi_paired_bracket_type/1 which returns the type of a codepoint, or the list of types of a string.
Summary
Functions
Returns a map of aliases for Unicode bidi paired bracket types.
Returns the bidi paired bracket type of the given binary or codepoint.
Returns the map of Unicode bidi paired bracket types.
Returns the count of the codepoints with a given bidi paired bracket type.
Returns the Unicode codepoint ranges for a given bidi paired bracket type.
Returns the Unicode codepoint ranges for a given bidi paired bracket type.
Returns a list of known Unicode bidi paired bracket type names.
Functions
Returns a map of aliases for Unicode bidi paired bracket types.
Returns
- A map where the alias string is the key and the type is the value.
Examples
iex> Unicode.BidiPairedBracketType.aliases() |> Map.get("o")
:open
Returns the bidi paired bracket type of the given binary or codepoint.
Arguments
string_or_codepointis either a binary (String) or a codepoint in the range0..0x10FFFF.
Returns
For a codepoint, a single type atom is returned. Codepoints that are not brackets return
:none.For a binary, a list of the distinct types of the codepoints in the binary is returned.
Examples
iex> Unicode.BidiPairedBracketType.bidi_paired_bracket_type(?\()
:open
iex> Unicode.BidiPairedBracketType.bidi_paired_bracket_type(?\))
:close
iex> Unicode.BidiPairedBracketType.bidi_paired_bracket_type(?A)
:none
Returns the map of Unicode bidi paired bracket types.
Returns
- A map where the type (
:openor:close) is the key and a list of codepoint ranges as 2-tuples is the value.
Examples
iex> Unicode.BidiPairedBracketType.bidi_paired_bracket_types() |> Map.keys() |> Enum.sort()
[:close, :open]
Returns the count of the codepoints with a given bidi paired bracket type.
Aliases are resolved by this function.
Arguments
typeis any type name or alias, as an atom or string.
Returns
A non-negative integer count of the codepoints with the type.
:errorif the type is not known.
Examples
iex> is_integer(Unicode.BidiPairedBracketType.count(:open))
true
Returns the Unicode codepoint ranges for a given bidi paired bracket type.
Aliases are resolved by this function.
Arguments
typeis any type name or alias, as an atom or string.
Returns
{:ok, range_list}whererange_listis a list of codepoint ranges as 2-tuples.:errorif the type is not known.
Examples
iex> Unicode.BidiPairedBracketType.fetch(:open) |> elem(0)
:ok
iex> Unicode.BidiPairedBracketType.fetch(:invalid)
:error
Returns the Unicode codepoint ranges for a given bidi paired bracket type.
Aliases are resolved by this function.
Arguments
typeis any type name or alias, as an atom or string.
Returns
A list of codepoint ranges as 2-tuples.
nilif the type is not known.
Examples
iex> Unicode.BidiPairedBracketType.get(:invalid)
nil
Returns a list of known Unicode bidi paired bracket type names.
Returns
- A list of atom type names.
Examples
iex> :open in Unicode.BidiPairedBracketType.known_bidi_paired_bracket_types()
true