I'm doing some string
matching in Java. I need to match the symbol representing the group separator in the Polish language.
This is what equales to the ,
in the English language
100,000,121
So what is the code for that symbol in Polish? I'm doing this for a test suit testing if the Locale is working as expected, so I need to hard code the symbol
You don't need to parse it. If you set the locale appropriately then Java will do the parsing for you. Just use the NumberFormat.parse(String): http://docs.oracle.com/javase/6/docs/api/java/text/NumberFormat.html#parse%28java.lang.String%29
You can use my code to print a list of available locales and their format:
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.*;
public class Test {
public static void main(String args[]) {
Locale locales[] = SimpleDateFormat.getAvailableLocales();
NumberFormat cfLocal = null;
for (int i = 0; i < locales.length; i++) {
cfLocal = NumberFormat.getCurrencyInstance(locales[i]);
System.out.println(locales[i].toString()+" "
+locales[i].getDisplayName()+" "
+locales[i].getDisplayCountry()+" "
+cfLocal.format(1234567890.12));
}
}
}
The output would be
ms_MY Malay (Malaysia) Malaysia RM1,234,567,890.12
ar_QA Arabic (Qatar) Qatar ر.ق. 1,234,567,890.12
is_IS Icelandic (Iceland) Iceland 1.234.567.890, kr.
fi_FI Finnish (Finland) Finland 1 234 567 890,12 €
pl Polish ¤ 1 234 567 890,12
en_MT English (Malta) Malta €1,234,567,890.12
it_CH Italian (Switzerland) Switzerland SFr. 1'234'567'890.12
nl_BE Dutch (Belgium) Belgium 1.234.567.890,12 €
ar_SA Arabic (Saudi Arabia) Saudi Arabia ر.س. 1,234,567,890.12
ar_IQ Arabic (Iraq) Iraq د.ع. 1,234,567,890.12
es_PR Spanish (Puerto Rico) Puerto Rico $1,234,567,890.12
es_CL Spanish (Chile) Chile Ch$1.234.567.890
fi Finnish ¤ 1 234 567 890,12
de_AT German (Austria) Austria € 1.234.567.890,12
da Danish ¤ 1.234.567.890,12
en_GB English (United Kingdom) United Kingdom £1,234,567,890.12
es_PA Spanish (Panama) Panama B1,234,567,890.12
sr Serbian ¤ 1.234.567.890,12
ar_YE Arabic (Yemen) Yemen ر.ي. 1,234,567,890.12
mk_MK Macedonian (Macedonia) Macedonia Den 1.234.567.890,12
mk Macedonian ¤ 1.234.567.890,12
en_CA English (Canada) Canada $1,234,567,890.12
vi_VN Vietnamese (Vietnam) Vietnam 1.234.567.890,12 đ
nl_NL Dutch (Netherlands) Netherlands € 1.234.567.890,12
es_US Spanish (United States) United States US$1,234,567,890.12
zh_CN Chinese (China) China ¥1,234,567,890.12
es_HN Spanish (Honduras) Honduras L1,234,567,890.12
en_US English (United States) United States $1,234,567,890.12
fr French 1 234 567 890,12 ¤
th Thai ¤ 1,234,567,890.12
ar Arabic ¤ 1,234,567,890.12
ar_MA Arabic (Morocco) Morocco د.م. 1,234,567,890.12
lv Latvian ¤ 1 234 567 890,12
de German ¤ 1.234.567.890,12
in_ID Indonesian (Indonesia) Indonesia Rp1.234.567.890,12
hr Croatian ¤ 1.234.567.890,12
en_ZA English (South Africa) South Africa R 1,234,567,890.12
ko_KR Korean (South Korea) South Korea ₩1,234,567,890
ar_TN Arabic (Tunisia) Tunisia د.ت. 1,234,567,890.12
in Indonesian ¤1.234.567.890,12
ja Japanese ¤ 1,234,567,890.12
sr_RS Serbian (Serbia) Serbia дин. 1.234.567.890,12
be_BY Belarusian (Belarus) Belarus Руб1 234 567 890
zh_TW Chinese (Taiwan) Taiwan NT$1,234,567,890.12
ar_SD Arabic (Sudan) Sudan ج.س. 1,234,567,890.12
pt Portuguese ¤ 1.234.567.890,12
is Icelandic ¤ 1.234.567.890,12
ja_JP_JP_#u-ca-japanese Japanese (Japan,JP) Japan ¥1,234,567,890
es_BO Spanish (Bolivia) Bolivia B$1.234.567.890,12
ar_DZ Arabic (Algeria) Algeria د.ج. 1,234,567,890.12
ms Malay ¤ 1,234,567,890.12
es_AR Spanish (Argentina) Argentina $1.234.567.890,12
ar_AE Arabic (United Arab Emirates) United Arab Emirates د.إ. 1,234,567,890.12
fr_CA French (Canada) Canada 1 234 567 890,12 $
sl Slovenian ¤ 1.234.567.890,12
es Spanish ¤1.234.567.890,12
lt_LT Lithuanian (Lithuania) Lithuania 1 234 567 890,12 Lt
sr_ME_#Latn Serbian (Latin,Montenegro) Montenegro € 1,234,567,890.12
ar_SY Arabic (Syria) Syria ل.س. 1,234,567,890.12
ru_RU Russian (Russia) Russia 1 234 567 890,12 руб.
fr_BE French (Belgium) Belgium 1.234.567.890,12 €
es_ES Spanish (Spain) Spain 1.234.567.890,12 €
bg Bulgarian ¤ 1 234 567 890,12
iw_IL Hebrew (Israel) Israel 1,234,567,890.12 ש"ח
sv Swedish ¤ 1 234 567 890,12
en English ¤1,234,567,890.12
iw Hebrew ¤ 1,234,567,890.12
da_DK Danish (Denmark) Denmark kr 1.234.567.890,12
es_CR Spanish (Costa Rica) Costa Rica C1,234,567,890.12
zh_HK Chinese (Hong Kong) Hong Kong HK$1,234,567,890.12
zh Chinese ¤ 1,234,567,890.12
ca_ES Catalan (Spain) Spain € 1.234.567.890,12
th_TH Thai (Thailand) Thailand ฿1,234,567,890.12
uk_UA Ukrainian (Ukraine) Ukraine 1 234 567 890,12 грн.
es_DO Spanish (Dominican Republic) Dominican Republic RD$1,234,567,890.12
es_VE Spanish (Venezuela) Venezuela BsF.1.234.567.890,12
pl_PL Polish (Poland) Poland 1 234 567 890,12 zł
ar_LY Arabic (Libya) Libya د.ل. 1,234,567,890.12
ar_JO Arabic (Jordan) Jordan د.أ. 1,234,567,890.12
it Italian ¤ 1.234.567.890,12
uk Ukrainian ¤ 1 234 567 890,12
hu_HU Hungarian (Hungary) Hungary 1 234 567 890,12 Ft
ga Irish ¤ 1,234,567,890.12
es_GT Spanish (Guatemala) Guatemala Q1,234,567,890.12
es_PY Spanish (Paraguay) Paraguay G1.234.567.890
bg_BG Bulgarian (Bulgaria) Bulgaria лв.1 234 567 890,12
hr_HR Croatian (Croatia) Croatia Kn 1.234.567.890,12
sr_BA_#Latn Serbian (Latin,Bosnia and Herzegovina) Bosnia and Herzegovina KM 1,234,567,890.12
ro_RO Romanian (Romania) Romania 1.234.567.890,12 LEI
fr_LU French (Luxembourg) Luxembourg 1 234 567 890,12 €
no Norwegian ¤ 1 234 567 890,12
lt Lithuanian ¤ 1 234 567 890,12
en_SG English (Singapore) Singapore $1,234,567,890.12
es_EC Spanish (Ecuador) Ecuador $1.234.567.890,12
sr_BA Serbian (Bosnia and Herzegovina) Bosnia and Herzegovina КМ. 1.234.567.890,12
es_NI Spanish (Nicaragua) Nicaragua $C1,234,567,890.12
sk Slovak ¤ 1 234 567 890,12
ru Russian ¤ 1 234 567 890,12
mt Maltese ¤ 1,234,567,890.12
es_SV Spanish (El Salvador) El Salvador C1,234,567,890.12
nl Dutch ¤ 1.234.567.890,12
hi_IN Hindi (India) India रू १,२३४,५६७,८९०.१२
et Estonian ¤ 1 234 567 890,12
el_GR Greek (Greece) Greece 1.234.567.890,12 €
sl_SI Slovenian (Slovenia) Slovenia € 1.234.567.890,12
it_IT Italian (Italy) Italy € 1.234.567.890,12
ja_JP Japanese (Japan) Japan ¥1,234,567,890
de_LU German (Luxembourg) Luxembourg 1.234.567.890,12 €
fr_CH French (Switzerland) Switzerland SFr. 1'234'567'890.12
mt_MT Maltese (Malta) Malta €1,234,567,890.12
ar_BH Arabic (Bahrain) Bahrain د.ب. 1,234,567,890.12
sq Albanian ¤ 1.234.567.890,12
vi Vietnamese ¤ 1.234.567.890,12
sr_ME Serbian (Montenegro) Montenegro € 1.234.567.890,12
pt_BR Portuguese (Brazil) Brazil R$ 1.234.567.890,12
no_NO Norwegian (Norway) Norway kr 1 234 567 890,12
el Greek ¤ 1.234.567.890,12
de_CH German (Switzerland) Switzerland SFr. 1'234'567'890.12
zh_SG Chinese (Singapore) Singapore S$1,234,567,890.12
ar_KW Arabic (Kuwait) Kuwait د.ك. 1,234,567,890.12
ar_EG Arabic (Egypt) Egypt ج.م. 1,234,567,890.12
ga_IE Irish (Ireland) Ireland €1,234,567,890.12
es_PE Spanish (Peru) Peru S/1.234.567.890,12
cs_CZ Czech (Czech Republic) Czech Republic 1 234 567 890,12 Kč
tr_TR Turkish (Turkey) Turkey 1.234.567.890,12 TL
cs Czech ¤ 1 234 567 890,12
es_UY Spanish (Uruguay) Uruguay NU$ 1.234.567.890,12
en_IE English (Ireland) Ireland €1,234,567,890.12
en_IN English (India) India Rs.1,234,567,890.12
ar_OM Arabic (Oman) Oman ر.ع. 1,234,567,890.12
sr_CS Serbian (Serbia and Montenegro) Serbia and Montenegro CSD 1.234.567.890,12
ca Catalan ¤ 1.234.567.890,12
be Belarusian ¤ 1 234 567 890,12
sr__#Latn Serbian (Latin) ¤ 1,234,567,890.12
ko Korean ¤ 1,234,567,890.12
sq_AL Albanian (Albania) Albania Lek1.234.567.890,12
pt_PT Portuguese (Portugal) Portugal 1.234.567.890,12 €
lv_LV Latvian (Latvia) Latvia 1 234 567 890,12 Ls
sr_RS_#Latn Serbian (Latin,Serbia) Serbia din. 1,234,567,890.12
sk_SK Slovak (Slovakia) Slovakia 1 234 567 890,12 €
es_MX Spanish (Mexico) Mexico $1,234,567,890.12
en_AU English (Australia) Australia $1,234,567,890.12
no_NO_NY Norwegian (Norway,Nynorsk) Norway kr 1 234 567 890,12
en_NZ English (New Zealand) New Zealand $1,234,567,890.12
sv_SE Swedish (Sweden) Sweden 1 234 567 890,12 kr
ro Romanian ¤ 1.234.567.890,12
ar_LB Arabic (Lebanon) Lebanon ل.ل. 1,234,567,890.12
de_DE German (Germany) Germany 1.234.567.890,12 €
th_TH_TH_#u-nu-thai Thai (Thailand,TH) Thailand ฿๑,๒๓๔,๕๖๗,๘๙๐.๑๒
tr Turkish 1.234.567.890,12 ¤
es_CO Spanish (Colombia) Colombia $1.234.567.890,12
en_PH English (Philippines) Philippines Php1,234,567,890.12
et_EE Estonian (Estonia) Estonia 1 234 567 890,12 €
el_CY Greek (Cyprus) Cyprus €1.234.567.890,12
hu Hungarian ¤ 1 234 567 890,12
fr_FR French (France) France 1 234 567 890,12 €