开发者

Objective C, How to delete string character set?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜