开发者

Iphone : Problem regarding replacing String?

开发者 https://www.devze.com 2023-03-19 17:13 出处:网络
I Want Replace String \':\' by \'/\', I amUsing this code to replace NSString *newPath = [imgPath stringByReplacingOccurrencesOfString:@\":\" withString:@\"/\"];

I Want Replace String ':' by '/',

I am Using this code to replace

NSString *newPath = [imgPath stringByReplacingOccurrencesOfString:@":" withString:@"/"];

But at a time, I get this error

-[__NSCFDictionary stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance 0x664e650

W开发者_JAVA技巧hat Should I do ?


  1. imgPath is NSDictionary should be NSString.
  2. If imgpath is NSStRING, probably it is released already


I feel there might be some structured organized way the data in your NSString. I faced a similar situation . I had my data with recursive {}. You should replace NSString *imgPath to NSDictionary *dictPath . Having done that read your fields with [dictPath objectForKey:@"key"] than read the fields again in NSString and remove special characters.

0

精彩评论

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