问题
I have NSString @" (\n "Bi_ss" \n) "
I want to get String @"Bi_ss "
Any one has any idea about this ? Thank you
回答1:
NSString *trimmedString = [string stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
From Cocoanetics...
回答2:
Take a look at the NSString method stringByReplacingOccurrencesOfString:withString for example, this should be able to perform the basic task you want it to do.
来源:https://stackoverflow.com/questions/9431026/to-trim-spaces-an-n-from-nsstring