Module icu_decimal::parts
source · Expand description
Parts of a formatted decimal.
§Examples
use icu::calendar::Gregorian;
use icu::calendar::{Date, Time};
use icu::decimal::parts;
use icu::decimal::FixedDecimalFormatter;
use icu::locale::locale;
use writeable::assert_writeable_parts_eq;
let dtf = FixedDecimalFormatter::try_new(
locale!("en").into(),
Default::default(),
)
.unwrap();
let fixed_decimal = "-987654.321".parse().unwrap();
// Missing data is filled in on a best-effort basis, and an error is signaled.
assert_writeable_parts_eq!(
dtf.format(&fixed_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 byFormattedFixedDecimal
. - A [
Part
] used byFormattedFixedDecimal
. - A [
Part
] used byFormattedFixedDecimal
. - A [
Part
] used byFormattedFixedDecimal
. - A [
Part
] used byFormattedFixedDecimal
. - A [
Part
] used byFormattedFixedDecimal
.