0

In the app I have to set the text based on a certain condition. I have the following texts

var youTagged = "You Tagged 123 for 456"
var taggedYou = "123 Tagged you for 456" 

where 123 is gonna be replaced by Person's name and 456 with subject

Everything is working fine except when the person's name is in RTL based language.

In normal

it's getting replaced as

You Tagged Jack for "Sa"

or

Jack Tagged you for "Sa"

in problematic case

Tagged you for "Sa"ג'ֵק

the name is getting at the end of the string.

code:

var returnString = "" //text based on condition

returnString = returnString.replacingOccurrences(of: "123", with: name)
returnString = returnString.replacingOccurrences(of: "456", with: "\"\(tag)\"")
Community
  • 1
  • 1
Sahil Manchanda
  • 9,812
  • 4
  • 39
  • 89

0 Answers0