2

In my app, I use lowercaseString. When I change "İ" to lowercase, the output is incorrect. It puts more points on the smaller letters:

let isim = "titTTSSİŞÇÖÜİİİle".lowercaseString

The output is:

titttssi̇şçöüi̇i̇i̇le

The correct output for İ should be i

Undo
  • 25,519
  • 37
  • 106
  • 129
user2512558
  • 21
  • 2
  • 7
  • Can you post the output as text instead of an image? – rmaddy Jan 30 '16 at 17:19
  • Similar problem for conversion to upper case: [Uppercase All String According to Locale - Swift](http://stackoverflow.com/questions/32715323/uppercase-all-string-according-to-locale-swift) – Martin R Jan 30 '16 at 17:24
  • The `i̇` is actually the standard lowercase letter `i` and a "combining dot above". – rmaddy Jan 30 '16 at 17:35

2 Answers2

6

It looks like this is Turkish text. You can use lowercaseStringWithLocale to handle this correctly:

4> let isim = "titTTSSİŞÇÖÜİİİle".lowercaseStringWithLocale(NSLocale(localeIdentifier: "tr"))
isim: String = "titttssişçöüiiile"

You may wish to use NSLocale.currentLocale instead, to accommodate users in different locales based on their preferences.

Undo
  • 25,519
  • 37
  • 106
  • 129
0

You may have to change that character separately. Perhaps something like this:

var isim: NSString = "titTTSSİŞÇÖÜİİİle".lowercaseString
isim = isim.stringByReplacingOccurrencesOfString("İ", withString: "i")

Hope this helps.

Pranav Wadhwa
  • 7,666
  • 6
  • 39
  • 61