How to remove whitespace in a string?

后端 未结 13 2137
天涯浪人
天涯浪人 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:47

    Probably the solution in one of the answers in Collapse sequences of white space into a single character and trim string:

    NSString *whitespaceString = @" String with whitespaces ";
    
    NSString *trimmedString = [whitespaceString stringByReplacingOccurrencesOfString:@" " withString:@""];
    
    0 讨论(0)
提交回复
热议问题