I need to parse a URL string like this one:
&ad_eurl=http://www.youtube.com/video/4bL4FI1Gz6s&hl=it_IT&iv_logging_level=3&ad_flags=0&endscreen_module=http://s.ytimg.com/yt/swfbin/endscreen-vfl6o3XZn.swf&cid=241&cust_gender=1&avg_rating=4.82280613104
I need to split the NSString up into the signle parts like cid=241
and &avg_rating=4.82280613104
. I've been doing this with substringWithRange:
but the values return in a random order, so that messes it up. Is there any class that allows easy parsing where you can basically convert it to NSDictionary to be able to read the value for a key (for example ValueForKey:cid
should return 241
). Or is there just another easier way to parse it than using NSMakeRange
to get a substring?