Skip to content

Instantly share code, notes, and snippets.

@hachi8833
Created April 28, 2021 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hachi8833/268c4fa95cf44c1b44c2dac2e8663c6e to your computer and use it in GitHub Desktop.
Save hachi8833/268c4fa95cf44c1b44c2dac2e8663c6e to your computer and use it in GitHub Desktop.
Sequence of converting country code to flag
"FR".codepoints
#=> [70, 82]
70 + 127397
#=> 127467
127467.chr(Encoding::UTF_8)
#=> "🇫"
82 + 127397
#=> 1274879
127479.chr(Encoding::UTF_8)
#=> "🇷"
["🇫", "🇷"].join
#=> "🇫🇷"
"🇫🇷".codepoints # 確認
#=> [127467, 127479]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment