Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Locale;
- public class LocaleIteration {
- public static void main(String[] args) {
- //List of all countries' 2 digit code... AF,US,TH,etc.
- String[] isoCountries = Locale.getISOCountries();
- String ctry_id = "USA"; //ctry_id we receive from Archibus
- for (String country : isoCountries) {
- Locale locale = new Locale("en", country);
- String ThreeCharacterName = locale.getISO3Country();
- String TwoCharacterName = locale.getCountry();
- String CountryName = locale.getDisplayCountry();
- //System.out.println("ISO3 Code: " + code + " , Name: " + TwoCharacternName + " , Display: " + CountryName);
- if (ThreeCharacterName.equals(ctry_id)) {
- System.out.println("ctry_id: " + ctry_id + " || " +
- "ISO3 Code: " + ThreeCharacterName +
- " , Name: " + TwoCharacterName +
- " , Display: " + CountryName);
- System.out.println("return: " + TwoCharacterName);
- //return TwoCharactername
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement