Skip to content

Instantly share code, notes, and snippets.

@sneakyness
Created February 21, 2012 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sneakyness/1879211 to your computer and use it in GitHub Desktop.
Save sneakyness/1879211 to your computer and use it in GitHub Desktop.
URL Query to Dict
NSArray *parameters = [[url query] componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"=&"]];
NSMutableDictionary *keyValueParm = [NSMutableDictionary dictionary];
for (int i = 0; i < [parameters count]; i=i+2) {
[keyValueParm setObject:[parameters objectAtIndex:i+1] forKey:[parameters objectAtIndex:i]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment