Module num_format::parsing

source ·
Expand description

Module with traits for parsing a formatted string into a number.

Examples

use num_format::Locale;
use num_format::parsing::ParseFormatted;

fn main() {
    let s = "1,000,000";
    let n = s.parse_formatted::<_, u32>(&Locale::en).unwrap();
    assert_eq!(n, 1_000_000);
}

Traits

Marker trait for number types (e.g. u32) that string-like types can be parsed into via the ParseFormatted trait.
Trait that provides string-like types with a parse_formatted method, allowing conversion from a formatted string into a number.