The parse method of the NumberFormat(currency formatter) takes a string and returns a Number object.
However according to the book(Khalid Mughal), the space character which is used as a grouping character in formatting numbers in the norwegian locale, acts as a delimiter in a string and thereby results in the termination of any parsing.
If so, why does the second parse call return the original Number object while the first fails, when both accept the same string value as an argument.
Does it have to do anything with how the String is represented internally by the JVM?
Effectively the input string "kr 1 233 232,00" and the one printed by the console, originated by the parsing, are different...
The space used as separator is a non-breaking space (ASCII code 160), while the other is breaking ( ASCII code 32)
you can perform a test by yourself, applying this on the two strings
The important is not what you know, but when you know it...
Joined: Aug 02, 2006
Thanks a bunch Simone. Even I was thinking somewhat on the same lines, but nowhere close. Thanks again.
Joined: Oct 13, 2010
You are welcome
subject: Parse method discrepancy of NumberFormat(CurrencyFormatter)