Expand description
Parts of a formatted decimal.
§Examples
use icu::decimal::parts;
use icu::decimal::DecimalFormatter;
use icu::locale::locale;
use writeable::assert_writeable_parts_eq;
let formatter = DecimalFormatter::try_new(
locale!("en").into(),
Default::default(),
)
.unwrap();
let decimal = "-987654.321".parse().unwrap();
// Missing data is filled in on a best-effort basis, and an error is signaled.
assert_writeable_parts_eq!(
formatter.format(&decimal),
"-987,654.321",
[
(0, 1, parts::MINUS_SIGN),
(1, 8, parts::INTEGER),
(4, 5, parts::GROUP),
(8, 9, parts::DECIMAL),
(9, 12, parts::FRACTION),
]
);
Constants§
- A [
Part
] used byFormattedDecimal
. - A [
Part
] used byFormattedDecimal
. - A [
Part
] used byFormattedDecimal
. - A [
Part
] used byFormattedDecimal
. - A [
Part
] used byFormattedDecimal
. - A [
Part
] used byFormattedDecimal
.