I download strings from a web server and it contains spe开发者_Python百科cial characters such as /n /p and so on. What is the best way to get rid of these?
do you have a list of characters that need stripping? or you could use
[string stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
I'd have thought your best bet would be to use one of the NSString methods such as stringByReplacingCharactersInRange:withString:
(replacing the characters in question with an empty string) or stringByTrimmingCharactersInSet:
.
you can use
Str=[Str stringByReplacingOccurrencesOfString:@"/n" withString:@""];
if you have selected special characters use Array of special characters and then will also work.
精彩评论