2012年2月7日 星期二

[iOS Dev] Parse query string into dictionary

Usage:
NSString *qs = @"username=hank&age=27&blog=whhnote.blogspot.com";
NSDictionary *queryParams = [self parseQueryString:qs];
NSLog(@"%@", queryParams);
NSLog(@"%@", [queryParams objectForKey:@"username"]); // get username from dict
So, you will get a dictionary look like
{
    age = 27;
    blog = "whhnote.blogspot.com";
    username = hank;
}
Related Posts Plugin for WordPress, Blogger...