bcmyers / num-format

A Rust crate for producing string representations of numbers, formatted according to international standards
Apache License 2.0
123 stars 22 forks source link

Add parsing of formatted strings into integers #15

Open bcmyers opened 5 years ago

zbraniecki commented 5 years ago

that's likely a rabbit hole right here... Trying to guess which locale the number is in to distinguish between 1,000 being a float with int 1 and fraction 000 and an int 1000 with thousands separator, will be tricky.

And then, other numbering systems come in... In JS we decided not to do that for this reason.

bcmyers commented 5 years ago

I figured I would make the caller pass the locale explicitly, as I agree it's a rabbit hole otherwise.

Example...

let n = "1,000".parse_formatted::<_, u32>(&Locale:en)?;