num-format icon indicating copy to clipboard operation
num-format copied to clipboard

Add parsing of formatted strings into integers

Open bcmyers opened this issue 5 years ago • 2 comments

bcmyers avatar Feb 19 '19 22:02 bcmyers

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.

zbraniecki avatar Feb 21 '19 20:02 zbraniecki

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)?;

bcmyers avatar Feb 21 '19 23:02 bcmyers