Skip to content

Latest commit

 

History

History
72 lines (45 loc) · 1.65 KB

README.md

File metadata and controls

72 lines (45 loc) · 1.65 KB

country-emoji

crate.io

Converts between country names, ISO 3166-1 codes and flag emojis.

Usage

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

Don't want Rust?

Check out the following:

Bugs and feedback

If you discover a bug please report it here. Express gratitude here.

Mail me at [email protected], or on twitter @leodutra.

Credits

This library is based on the work of two existing library:

Thanks guys for your work!

License

MIT @ Leo Dutra