Cldr Numbers v2.3.0 Cldr.Number.Formatter.Decimal View Source
Formats a number according to a locale-specific predefined format or a user-defined format.
As a performance optimization, all decimal formats known at compile time are compiled into function that roughly halves the time to format a number compared to a non-precompiled format.
The available format styles for a locale can be returned by:
iex> Cldr.Number.Format.decimal_format_styles_for("en", :latn, TestBackend.Cldr)
{:ok, [:accounting, :currency, :currency_long, :percent, :scientific, :standard]}
This allows a number to be formatted in a locale-specific way but using a standard method of describing the purpose of the format.
This module is not part of the public API and is subject to change at any time.
Link to this section Summary
Functions
Formats a number according to a decimal format string
Link to this section Functions
absolute_value(number, meta, backend, options) View Source
add_first_group(groups, first, separator) View Source
add_last_group(groups, last, separator) View Source
add_separator(group, every, separator) View Source
adjust_for_fractional_digits(meta, digits) View Source
adjust_fraction_for_currency(meta, currency, arg3, backend) View Source
adjust_fraction_for_significant_digits(meta, number) View Source
adjust_leading_zeros(arg, map, backend, options) View Source
adjust_trailing_zeros(arg, map, backend, options) View Source
apply_grouping(arg, map1, backend, map2) View Source
assemble_format(number_string, meta, backend, options) View Source
currency_symbol(currency, number, size, locale, backend) View Source
do_adjust_fraction(meta, digits, rounding) View Source
do_grouping(number, arg2, length, min_grouping, arg5) View Source
do_max_integer_digits(integer, over) View Source
do_trailing_zeros(fraction, count) View Source
minimum_group_size(map, minimum_grouping_digits, locale, backend) View Source
multiply_by_factor(number, map, backend, options) View Source
output_to_tuple(number, meta, backend, options) View Source
padding_string(meta, number_string) View Source
reassemble_number_string(arg, meta, backend, options) View Source
round_fractional_digits(arg, arg2, backend, arg4) View Source
round_to_nearest(number, map1, backend, map2) View Source
round_to_significant_digits(number, map, backend, options) View Source
set_exponent(number, meta, backend, options) View Source
set_max_integer_digits(number, map, backend, options) View Source
to_string(number, format, backend, options \\ [])
View Source
to_string(Cldr.Math.number(), String.t(), Cldr.backend(), list()) ::
{:ok, String.t()} | {:error, {atom(), String.t()}}
to_string(
Cldr.Math.number(),
String.t(),
Cldr.backend(),
Cldr.Number.Format.Options.t()
) :: {:ok, String.t()} | {:error, {atom(), String.t()}}
to_string(Cldr.Math.number(), String.t(), Cldr.backend(), list()) :: {:ok, String.t()} | {:error, {atom(), String.t()}}
to_string( Cldr.Math.number(), String.t(), Cldr.backend(), Cldr.Number.Format.Options.t() ) :: {:ok, String.t()} | {:error, {atom(), String.t()}}
Formats a number according to a decimal format string.
Arguments
number
is an integer, float or Decimalformat
is a format string. SeeCldr.Number
for further information.backend
is any module that includesuse Cldr
and therefore is aCldr
backend moduleoptions
is a map of options. SeeCldr.Number.to_string/2
for further information.