0

I want to replace a particular string from selected range only. e.g

"Hello @Bob and @Bob friend"

Output :

"Hello @Bob and friend"

I just want to remove the last word from selected range @Bob even it contains a duplicates in whole sentance and want to show it on UItextfield swift.

for more information i am looking something just like adding and removing tagging friends in whatsapp group.

Sanket
  • 33
  • 1
  • 7
  • 1
    Have a look at [How do I find the last occurrence of a substring in a Swift string?](https://stackoverflow.com/questions/26411635/how-do-i-find-the-last-occurrence-of-a-substring-in-a-swift-string), in particular https://stackoverflow.com/a/44713353/1187415. – Martin R Sep 16 '17 at 09:36
  • Yeah this is a duplicate you can checkout https://stackoverflow.com/questions/24200888/any-way-to-replace-characters-on-swift-string – GyroCocoa Sep 16 '17 at 10:16

0 Answers0