Url minus query string in Objective-C
What's the best way to get an url minus its query string in Objective-C? An example: Input: http://www.example.com/folder/page.htm?param1=value1¶m2=value2 Output: http://www.example.com/folder/page.htm Is there a NSURL method to do this that I'm missing? There's no NSURL method I can see. You might try something like: NSURL *newURL = [[NSURL alloc] initWithScheme:[url scheme] host:[url host] path:[url path]]; Testing looks good: #import <Foundation/Foundation.h> int main(int argc, char *argv[]) { NSAutoreleasePool *arp = [[NSAutoreleasePool alloc] init]; NSURL *url = [NSURL URLWithString:@