除此之外Locale.getISOCountries(),因为我已经遇到了一些奇怪的错误.获取2个字母的国家/地区代码以及完整的国家/地区名称的最佳方法是什么?
mky*_*ong 43
请参阅代码段:
String[] countryCodes = Locale.getISOCountries();
for (String countryCode : countryCodes) {
Locale obj = new Locale("", countryCode);
System.out.println("Country Code = " + obj.getCountry()
+ ", Country Name = " + obj.getDisplayCountry());
}
Run Code Online (Sandbox Code Playgroud)