I\'m trying to uppercase all string according to \'Locale\' but it is not working.
var text = \"istanbul, izmir\"
println(text.uppercaseStringWithLocale(NSL
NSLocale.currentLocale() is the locale which was selected in the
Settings of the device. If that is "en_US" then
text.uppercaseStringWithLocale(NSLocale.currentLocale())
will use the english language rules and the result is "ISTANBUL, IZMIR".
You can either select the turkish language in the device settings, or specify the turkish locale explicitly:
let text = "istanbul, izmir"
text.uppercaseStringWithLocale(NSLocale(localeIdentifier: "tr"))
// İSTANBUL, İZMİR
Swift 3:
text.uppercased(with: Locale(identifier: "tr"))