ios - Is there a way to convert special characters to normal characters in Swift? -
this question has answer here:
- how remove diacritics string in swift? 2 answers
suppose have string value special accents :
éáüîāṁṇār̥
is there universal/dynamic way convert/strip these types of characters down basic formatting ?..
eauiamnar
use stringbyfoldingwithoptions
, pass .diacriticinsensitivesearch
let s = "éáüîāṁṇār̥" let r = s.stringbyfoldingwithoptions(.diacriticinsensitivesearch, locale: nil) print(r) // prints eauiamnar
Comments
Post a Comment