标签:for har scan and sch copy sel obj array
@implementation NSString (URLParser)
-(NSDictionary*)parserToDict
{
NSScanner *scanner = [NSScanner scannerWithString:self];
[scanner setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@"&?="]];
NSString *key;
NSString *value;
NSMutableArray *keys = [NSMutableArray new];
NSMutableArray *vars = [NSMutableArray new];
[scanner scanUpToString:@"?" intoString:nil]; //ignore the beginning of the string and skip to the vars
while ([scanner scanUpToString:@"=" intoString:&key]&&[scanner scanUpToString:@"&" intoString:&value]) {
//[vars addObject:[tempString copy]];
[keys addObject:key];
[vars addObject:value];
}
return [NSDictionary dictionaryWithObjects:vars forKeys:keys];
}
@end
标签:for har scan and sch copy sel obj array
原文地址:http://www.cnblogs.com/feng9exe/p/7008633.html