objective c - Multiple Substrings in String -


i´m working on app displays 6 pictures website. these pictures change on time extracted sourcecode of said website , managed pull first of 6 pictures code:

nserror *error = nil; nsstring *deviantstringpopular; deviantstringpopular = [nsstring stringwithcontentsofurl:[nsurl     urlwithstring:@"http://browse.deviantart.com/?order=24"]                                          encoding:nsisolatin1stringencoding                                             error:&error]; nsstring *popularcontent; nsrange popularurlrange1 = [deviantstringpopular rangeofstring:@"super_img=\""]; nsrange popularurlrange2 = [deviantstringpopular rangeofstring:@"\" super_w"]; int lengt = popularurlrange2.location - popularurlrange1.location -     popularurlrange1.length; int location = popularurlrange1.location + popularurlrange1.length; nsrange endrange; endrange.location = location; endrange.length = lengt; popularcontent = [deviantstringpopular substringwithrange:endrange]; nslog(@"%@", popularcontent); 

the problem is, other 5 images' urls between same substrings first one. possible first image's url ignored once it´s loaded , second 1 loads , stored under different variable , on?

thanks in advance

to 6 urls string , load them different variables, try using loop. each iteration, after substring found , stored variable, make range beginning of string end of substring found. can use stringbyreplacingcharactersinrange erase part of string searched next time search string substring, find next url.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -