开发者

Objective C, How to delete string character set?

开发者 https://www.devze.com 2023-02-17 20:29 出处:网络
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 s

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

精彩评论

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