View Source Cldr.Number.Symbol (Cldr Numbers v2.30.1)

Functions to manage the symbol definitions for a locale and number system.

Link to this section Summary

Functions

Returns a list of all decimal symbols defined by the locales configured in the given backend as a list.

Returns a list of all decimal symbols defined by the locales configured in the given backend as a string.

Returns a list of all grouping symbols defined by the locales configured in the given backend as a list.

Returns a list of all grouping symbols defined by the locales configured in the given backend as a string.

Returns a map of Cldr.Number.Symbol.t structs of the number symbols for each of the number systems of a locale.

Returns the number symbols for a specific locale and number system.

Link to this section Types

@type t() :: %Cldr.Number.Symbol{
  decimal: String.t(),
  exponential: String.t(),
  group: String.t(),
  infinity: String.t(),
  list: String.t(),
  minus_sign: String.t(),
  nan: String.t(),
  per_mille: String.t(),
  percent_sign: String.t(),
  plus_sign: String.t(),
  superscripting_exponent: String.t(),
  time_separator: String.t()
}

Link to this section Functions

Link to this function

all_decimal_symbols(backend)

View Source

Returns a list of all decimal symbols defined by the locales configured in the given backend as a list.

arguments

Arguments

  • backend is any module that includes use Cldr and therefore is a Cldr backend module
Link to this function

all_decimal_symbols_class(backend)

View Source

Returns a list of all decimal symbols defined by the locales configured in the given backend as a string.

This string can be used as a character class when builing a regular expression.

arguments

Arguments

  • backend is any module that includes use Cldr and therefore is a Cldr backend module
Link to this function

all_grouping_symbols(backend)

View Source

Returns a list of all grouping symbols defined by the locales configured in the given backend as a list.

arguments

Arguments

  • backend is any module that includes use Cldr and therefore is a Cldr backend module
Link to this function

all_grouping_symbols_class(backend)

View Source

Returns a list of all grouping symbols defined by the locales configured in the given backend as a string.

This string can be used as a character class when builing a regular expression.

arguments

Arguments

  • backend is any module that includes use Cldr and therefore is a Cldr backend module
Link to this function

number_symbols_for(locale, backend)

View Source
@spec number_symbols_for(
  Cldr.LanguageTag.t() | Cldr.Locale.locale_name(),
  Cldr.backend()
) ::
  {:ok, map()} | {:error, {module(), String.t()}}

Returns a map of Cldr.Number.Symbol.t structs of the number symbols for each of the number systems of a locale.

arguments

Arguments

example

Example:

iex> Cldr.Number.Symbol.number_symbols_for("th", TestBackend.Cldr)
{:ok, %{
   latn: %Cldr.Number.Symbol{
     decimal: ".",
     exponential: "E",
     group: ",",
     infinity: "∞",
     list: ";",
     minus_sign: "-",
     nan: "NaN",
     per_mille: "‰",
     percent_sign: "%",
     plus_sign: "+",
     superscripting_exponent: "×",
     time_separator: ":"
   },
   thai: %Cldr.Number.Symbol{
     decimal: ".",
     exponential: "E",
     group: ",",
     infinity: "∞",
     list: ";",
     minus_sign: "-",
     nan: "NaN",
     per_mille: "‰",
     percent_sign: "%",
     plus_sign: "+",
     superscripting_exponent: "×",
     time_separator: ":"
   }
 }}
Link to this function

number_symbols_for(locale, number_system, backend)

View Source
@spec number_symbols_for(
  Cldr.LanguageTag.t() | Cldr.Locale.locale_name(),
  Cldr.Number.System.system_name(),
  Cldr.backend()
) :: {:ok, map()} | {:error, {Cldr.NoNumberSymbols, String.t()}}

Returns the number symbols for a specific locale and number system.

options

Options

example

Example

iex> Cldr.Number.Symbol.number_symbols_for("th", "thai", TestBackend.Cldr)
{:ok, %Cldr.Number.Symbol{
   decimal: ".",
   exponential: "E",
   group: ",",
   infinity: "∞",
   list: ";",
   minus_sign: "-",
   nan: "NaN",
   per_mille: "‰",
   percent_sign: "%",
   plus_sign: "+",
   superscripting_exponent: "×",
   time_separator: ":"
 }}