Java Currency and Locale - Updates
This is an update to Java Currency and Locale - Miscellaneous Notes.
Older versions of Java (using older versions of CLDR rules) used to support code like this:
|
|
This would parse the currency string to the number 9.99
.
In Java 17 and later (and possibly earlier), this behavior has changed. The standard space character (U+0020
) is no longer the expected separator between the number and the currency symbol. The non-breaking space (U+00A0
) is now the expected separator.
So, the following works:
|
|
Or this:
|
|
I suppose we need to be careful that the only space in the string is the one between the amount and the currency symbol…
Author northCoder
LastMod 07-Apr-2023