Advertisement
Guest User

Untitled

a guest
Aug 15th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import java.util.Locale;
  2.  
  3. public class LocaleIteration {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. //List of all countries' 2 digit code... AF,US,TH,etc.
  8. String[] isoCountries = Locale.getISOCountries();
  9. String ctry_id = "USA"; //ctry_id we receive from Archibus
  10.  
  11. for (String country : isoCountries) {
  12. Locale locale = new Locale("en", country);
  13. String ThreeCharacterName = locale.getISO3Country();
  14. String TwoCharacterName = locale.getCountry();
  15. String CountryName = locale.getDisplayCountry();
  16. //System.out.println("ISO3 Code: " + code + " , Name: " + TwoCharacternName + " , Display: " + CountryName);
  17. if (ThreeCharacterName.equals(ctry_id)) {
  18. System.out.println("ctry_id: " + ctry_id + " || " +
  19. "ISO3 Code: " + ThreeCharacterName +
  20. " , Name: " + TwoCharacterName +
  21. " , Display: " + CountryName);
  22.  
  23. System.out.println("return: " + TwoCharacterName);
  24. //return TwoCharactername
  25. }
  26.  
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement