Skip to main content

parse_decimal

Function parse_decimal 

Source
pub fn parse_decimal(text: &str) -> Option<f64>
Expand description

Reads a number a user typed: with the current language’s decimal separator, or with ., , or the Arabic decimal sign (people type what they are used to), in Western, Arabic-Indic or Persian digits.

What could as well be a number with a thousands separator is refused rather than guessed: two separators (1.234,5), and a whole number written with the language’s thousands separator (1,600 where the decimal separator is not ,, 1.600 where it is). 0,25, 2,5 and 1234,5 are read as decimals in every language.