In Polish regional setting decimal separator is ,
. In english it is .
. Maybe in other languages there are other separators. (Are there?).
I want to use BigDecimal
's String constructor while reading an input file.
In my file I want to use .
as a decimal separator.
How can I ensure that I don't get NumberFormatException
if a decimal separator of environment is not .
?
The BigDecimal
constructor - like Double.parseDouble
etc - always uses '.' as a decimal separator. It doesn't use the current culture at all, nor is there any way to specify a number format.
(It would be nice if this were clearly documented, admittedly...)