How to remove the last unicode symbol from NSString

前端 未结 3 1118
终归单人心
终归单人心 2020-12-15 13:31

I have implemented a custom keyboard associated with a text field, so when the user presses the delete button, I remove the last character from the string, and manually upda

3条回答
  •  醉酒成梦
    2020-12-15 14:04

    If you can't get this to work by default, then use an if/else block and test if the last character is part of a special character. If it is, use the substring to length-2, otherwise use the substring to length-1.

提交回复
热议问题