I'm trying to use LRM in order to make a string properly displays in arabic. My string is as follows:
Percentage is: 32.12%
However on arabic it displayed as:
%32.12 :نسبة ط
So far so good. On objective-c I've used in the past following markup to fix this problem:
[NSString stringWithFormat:@"\u200E %@", value]
But when I try it on Swift it just didn't move the percent:
"\u{200E}\(value)"
Am I using unicode characters wrong in Swift or I made mistake somewhere else?
The below should be a comment on the question, really, but I need the formatting...
I do this in a Playground (Xcode 7 beta 4)
let value = "32.12%"
print("نسبة ط:\u{200E}\(value)")
And it prints
32.12% :نسبة ط
Is that what you want?
Also
let value = "\u{200E}32.12%"
print("نسبة ط:\(value)")
works the same. This is in the Playground. Are you using an older version of Xcode perhaps?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With