Created
November 24, 2019 00:30
-
-
Save GrantJEmerson/c81eeb8f2a1eedc0277303f777b88877 to your computer and use it in GitHub Desktop.
Same String, Different Diacritics - SwiftMoji Entry #7
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
import Foundation | |
struct π€ { | |
var name: String | |
var comparisonName: String { | |
name.folding(options: [.diacriticInsensitive, .widthInsensitive, .caseInsensitive], | |
locale: .current) | |
} | |
} | |
var π¨βπ» = π€(name: "Sean") | |
var π¨βπΎ = π€(name: "seΓ‘n") | |
if π¨βπ».comparisonName == π¨βπΎ.comparisonName { | |
print("π¨βπ» and π¨βπΎ have the same name.") // β | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment