I\'m looking for a quick way to turn something like:
let germany = \"DE\"
into
let flag = \"\\u{1f1e9}\\u{1f1ea}\"
Two optimizations of matt's answer.
Here is the code.
func flag(from country:String) -> String {
let base : UInt32 = 127397
var s = ""
for v in country.uppercased().unicodeScalars {
s.unicodeScalars.append(UnicodeScalar(base + v.value)!)
}
return s
}