Created
February 17, 2015 17:42
-
-
Save Sephiroth87/0350b7f6eb6d1c27f5ca to your computer and use it in GitHub Desktop.
Swift flipping operator ⦅╯°□°⦆╯
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let conversionMap: [Character: Character] = [ | |
"\u{0021}" : "\u{00A1}", | |
"\u{0022}" : "\u{201E}", | |
"\u{0026}" : "\u{214B}", | |
"\u{0027}" : "\u{002C}", | |
"\u{0028}" : "\u{0029}", | |
"\u{002E}" : "\u{02D9}", | |
"\u{0033}" : "\u{0190}", | |
"\u{0034}" : "\u{152D}", | |
"\u{0036}" : "\u{0039}", | |
"\u{0037}" : "\u{2C62}", | |
"\u{003B}" : "\u{061B}", | |
"\u{003C}" : "\u{003E}", | |
"\u{003F}" : "\u{00BF}", | |
"\u{0041}" : "\u{2200}", | |
"\u{0042}" : "\u{10412}", | |
"\u{0043}" : "\u{2183}", | |
"\u{0044}" : "\u{25D6}", | |
"\u{0045}" : "\u{018E}", | |
"\u{0046}" : "\u{2132}", | |
"\u{0047}" : "\u{2141}", | |
"\u{004A}" : "\u{017F}", | |
"\u{004B}" : "\u{22CA}", | |
"\u{004C}" : "\u{2142}", | |
"\u{004D}" : "\u{0057}", | |
"\u{004E}" : "\u{1D0E}", | |
"\u{0050}" : "\u{0500}", | |
"\u{0051}" : "\u{038C}", | |
"\u{0052}" : "\u{1D1A}", | |
"\u{0054}" : "\u{22A5}", | |
"\u{0055}" : "\u{2229}", | |
"\u{0056}" : "\u{1D27}", | |
"\u{0059}" : "\u{2144}", | |
"\u{005B}" : "\u{005D}", | |
"\u{005F}" : "\u{203E}", | |
"\u{0061}" : "\u{0250}", | |
"\u{0062}" : "\u{0071}", | |
"\u{0063}" : "\u{0254}", | |
"\u{0064}" : "\u{0070}", | |
"\u{0065}" : "\u{01DD}", | |
"\u{0066}" : "\u{025F}", | |
"\u{0067}" : "\u{0183}", | |
"\u{0068}" : "\u{0265}", | |
"\u{0069}" : "\u{0131}", | |
"\u{006A}" : "\u{027E}", | |
"\u{006B}" : "\u{029E}", | |
"\u{006C}" : "\u{0283}", | |
"\u{006D}" : "\u{026F}", | |
"\u{006E}" : "\u{0075}", | |
"\u{0072}" : "\u{0279}", | |
"\u{0074}" : "\u{0287}", | |
"\u{0076}" : "\u{028C}", | |
"\u{0077}" : "\u{028D}", | |
"\u{0079}" : "\u{028E}", | |
"\u{007B}" : "\u{007D}", | |
"\u{203F}" : "\u{2040}", | |
"\u{2045}" : "\u{2046}", | |
"\u{2234}" : "\u{2235}" | |
] | |
prefix operator ⦅╯°□°⦆╯{} | |
prefix func ⦅╯°□°⦆╯(string: String) -> String { | |
return String(map(string) { | |
conversionMap[$0] ?? $0 | |
}) | |
} | |
println(⦅╯°□°⦆╯"yeah") // "ʎǝɐɥ" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment