Created
September 4, 2019 08:09
-
-
Save karuppasamy/088abe51e22b5b513edb825dadfb83a2 to your computer and use it in GitHub Desktop.
Country flag by country code
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
// ruby | |
(->code { code.codepoints.map { |cp| cp + 127397 }.pack('U*') }).('GB') => "🇬🇧" | |
// javascript | |
(code => String.fromCodePoint(...[...code].map(c => 127397 + c.charCodeAt())))('GB') => "🇬🇧" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
List of country codes - https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes