icu_decimal
icu_decimal
offers localized decimal number formatting.
Currently, icu_decimal
provides FixedDecimalFormat
, which renders basic decimal numbers
in a locale-sensitive way.
Support for currencies, measurement units, and compact notation is planned. To track progress, follow this issue:
https://github.com/unicode-org/icu4x/issues/275
Examples
Format a number with Bengali digits
use FixedDecimalFormat;
use Locale;
use langid;
use Writeable;
let locale: Locale = langid!.into;
let provider = get_provider;
let fdf = try_new
.expect;
let fixed_decimal = 1000007.into;
let formatted_value = fdf.format;
let formatted_str = formatted_value.writeable_to_string;
assert_eq!;
Format a number with digits after the decimal separator
use FixedDecimal;
use FixedDecimalFormat;
use Locale;
use Writeable;
let locale = und;
let provider = InvariantDataProvider;
let fdf = try_new
.expect;
let fixed_decimal = from
.multiplied_pow10
.expect;
assert_eq!;
More Information
For more information on development, authorship, contributing etc. please visit ICU4X home page
.