Converts between country names, ISO 3166-1 codes and flag emojis.
use country_emoji::{flag, code, name, countries};
flag("CL")
// ~> 🇨🇱
code("🇨🇦")
// ~> CA
name("🇶🇦")
// ~> Qatar
// can extract name from string…
flag("Taiwan number one!")
// ~> 🇹🇼
// …but only if there"s no ambiguity
flag("Congo and Burma")
// ~> undefined
flag("Republic of Tanzania")
// ~> 🇹🇿
flag("Tanzania, United Republic of")
// ~> 🇹🇿
code("Australia")
// ~> AU
code("UAE")
// ~> AE
name("AE")
// ~> United Arab Emirates
code("UK")
// ~> GB
Check out the following:
- JavaScript: country-emoji
- Swift: SwiftFlags (ref: #16)
If you discover a bug please report it here. Express gratitude here.
Mail me at leodutra.br+foss@gmail.com, or on twitter @leodutra.
This library is based on the work of two existing library:
- country-emoji, available for JavaScript
- flag-emoji-from-country-code, a great snippet to get the emoji flag from an ISO 3166-1 region code
Thanks guys for your work!
MIT @ Leo Dutra