Apply locale-aware grouping and decimal point replacement to a formatted number.
(magnitude_str: String, locale: &LocaleInfo)
| 524 | |
| 525 | /// Apply locale-aware grouping and decimal point replacement to a formatted number. |
| 526 | fn apply_locale_formatting(magnitude_str: String, locale: &LocaleInfo) -> String { |
| 527 | let mut parts = magnitude_str.splitn(2, '.'); |
| 528 | let int_part = parts.next().unwrap(); |
| 529 | let grouped = Self::insert_locale_grouping(int_part, locale); |
| 530 | |
| 531 | if let Some(frac_part) = parts.next() { |
| 532 | format!("{grouped}{}{frac_part}", locale.decimal_point) |
| 533 | } else { |
| 534 | grouped |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | /// Format an integer with locale-aware 'n' format. |
| 539 | pub fn format_int_locale( |