pub fn regional_flag(regional_code: &str) -> String
Available on crate feature alloc only.
Expand description

Generate an ad-hoc regional flag.

This function allows to create arbitrary regional flags.

The Unicode standard defines regional flags based the ISO regions (see ISO 3166-2) which consist of the two-letter country code (ISO 3166-1 alpha-2) combined with up to three further characters to specify the region.

Panics

If the provided string contains characters other than ASCII.

Examples

use emojic::regional_flag;

assert_eq!(
    regional_flag("GB-ENG"), // 🏴󠁧󠁢󠁥󠁮󠁧󠁿 (England region of United Kingdom (GB))
    emojic::flat::FLAG_ENGLAND.to_string()
);

But there is no validity test:

use emojic::regional_flag;

println!("{}",
    regional_flag("ZZ-ABC") // 🏴󠁺󠁺󠁡󠁢󠁣󠁿 (an invalid flag)
);