Last active
March 24, 2020 22:31
-
-
Save havenwood/4f665a37b146f3829fcaac75523d87ff to your computer and use it in GitHub Desktop.
Country Emoji
This file contains 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
COUNTRY_LETTERS = 'A'.upto('Z').with_index(127462).to_h.freeze | |
def country_emoji(iso) | |
COUNTRY_LETTERS.values_at(*iso.chars).pack('U*') | |
end | |
country_emoji('GB') | |
#=> "🇬🇧" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment