开发者

How to replace all the white spaces from the string items in my array

开发者 https://www.devze.com 2023-03-27 00:09 出处:网络
I have an NSMutableArray with some NSString items . The problem is that , the string items contains some white spaces in the path name . how to remove the extra space in these strings . I manually rep

I have an NSMutableArray with some NSString items . The problem is that , the string items contains some white spaces in the path name . how to remove the extra space in these strings . I manually replaced the white space with the '%20' like this

http://mysites/livingrom/quaba%20mcose%2001_12.jpg 

But how to replace all the white spaces from the items in my array .

NSString *pic1 = http://mysites/livingrom/quaba mcose 01_12.jpg
NSString *pic2 = http://mysites/livingrom/quaba mcose 01_13.jpg
NSString *pic3 = http://my开发者_如何学编程sites/livingrom/quaba mcose 01_14.jpg
NSString *pic4 = http://mysites/livingrom/quaba mcose 01_15.jpg


Try this with all the NSStrings:

      [pic1 replaceOccurrencesOfString:@" " withString:@""];

I'm not sure if this will work, I've only used it to replace strings when reading from files. It's worth a try though.

0

精彩评论

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