8

Suppose I have the String value with special accents :

éáüîāṁṇār̥

Is there a universal/dynamic way to convert/strip these types of characters down to a basic formatting like ?..

eauiamnar
Trip
  • 26,093
  • 43
  • 151
  • 267

1 Answers1

19

Use stringByFoldingWithOptions and pass .DiacriticInsensitiveSearch

let s = "éáüîāṁṇār̥"
let r = s.stringByFoldingWithOptions(.DiacriticInsensitiveSearch, locale: nil)
print(r) // prints eauiamnar
Sergey Kalinichenko
  • 697,062
  • 78
  • 1,055
  • 1,465
  • 1
    Another reference here.... http://stackoverflow.com/questions/29521951/how-to-remove-diacritics-from-a-string-in-swift – Pan Mluvčí Nov 22 '16 at 10:16