MCPcopy Index your code
hub / github.com/RustPython/RustPython / apply_locale_formatting

Method apply_locale_formatting

crates/common/src/format.rs:526–536  ·  view source on GitHub ↗

Apply locale-aware grouping and decimal point replacement to a formatted number.

(magnitude_str: String, locale: &LocaleInfo)

Source from the content-addressed store, hash-verified

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(

Callers

nothing calls this directly

Calls 3

splitnMethod · 0.80
unwrapMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected