How to remove whitespace in a string?

后端 未结 13 2191
天涯浪人
天涯浪人 2020-12-17 08:12

I have a string say \"Allentown, pa\"

How to remove the white space in between , and pa using objective c?

13条回答
  •  孤城傲影
    2020-12-17 08:32

    In my case NSString was added Zero Width Space(i i used some library). so solution worked for me.

    NSMutableString *newString=[[newString stringByReplacingOccurrencesOfString:@"\u200B" withString:@""] mutableCopy];
    

    @"\u200B" is Zero width space character value.

提交回复
热议问题