Last active
August 29, 2015 14:19
-
-
Save nelanka/d4f94de3d0a3cc69f1f3 to your computer and use it in GitHub Desktop.
Country Codes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Locale | |
lazy val countryNameToCode = Locale.getISOCountries.map{ countryCode => | |
(new Locale("", countryCode).getDisplayCountry, countryCode) | |
}.toMap | |
lazy val countryCodeToName = countryNameToCode.map(_.swap) | |
countryCodeToName("HK") | |
countryCodeToName("GB") | |
countryCodeToName("US") | |
countryCodeToName("ZA") | |
countryNameToCode("Hong Kong") | |
countryNameToCode("United Kingdom") | |
countryNameToCode("United States") | |
countryNameToCode("South Africa") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment