1

In swift 3 I use following code:

let str = "Hello Ž Đ Š Č ž đ ć č š"
let x = str.folding(options: .diacriticInsensitive, locale: .current)

but x will be "Hello Z Đ S C z đ c c s".

How can I achieve that "Đ" and "đ" will be "D" and "d"?

A. Kniesel
  • 135
  • 1
  • 7
  • 2
    Compare http://stackoverflow.com/questions/16836975/ios-cfstringtransform-and-Đ. – As I understand it, `Đ` is a separate character and *not* the combination of `D` with a diacritical mark. – Martin R Jan 16 '17 at 18:30
  • Thanks, it seems I have to use this: let y = x.replacingOccurrences(of: "Đ", with: "D") – A. Kniesel Jan 16 '17 at 18:43

0 Answers0