java - Parse String to Long using a specified locale (sv) and NumberFormat -



java - Parse String to Long using a specified locale (sv) and NumberFormat -

i tried parse string (14 123) long in java using swedish locale using code:

string longstring = "14 123" numberformat swedishnumberformat = numberformat.getinstance(new locale("sv")); system.out.println(swedishnumberformat.parse(longstring).longvalue());

the output of code 14 (it should 14123). per this question tried both sv , sv_se locale time result identical in both cases.

according http://www.localeplanet.com/java/sv/index.html , http://www.localeplanet.com/java/sv-se/index.html grouping separator in both cases space() why string long parsing not handle a, locale, formatted double value stored string?

swedish, french too, needs hard. non-breaking space.

longstring = longstring.replace(' ', '\u00a0');

cumbersome.

java string parsing locale

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -