how to get rid of heading and trailing white spaces from NSString

前端 未结 2 761
北荒
北荒 2020-12-19 08:05

My NSString is like this:

NSString *myString =  
(  
“\\n \\n 24 K CLUB”,  
“\\n \\n 3 DOLLAR CAFE”,  
“\\n \\n A PEACH OF A PARTY”,  
“\\n \\n A ROYAL AFFAI         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-19 08:54

    How about stringByTrimmingCharactersInSet: method? By stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet], it can remove both ends of whitespace and newline characters.

提交回复
热议问题