Iphone SDk inString Function
- by Skeep
Hi All,
Im trying to write a method that will pull out the ID from a URI String. My code below seems inefficient, what would be a better way of finding the id string?
NSString *aID = [[[NSString alloc] initWithString:@"http://www.example.com/id368907840?mt=8&uo=4"] autorelease];
NSArray *arrStr = [aID componentsSeparatedByString:@"/id"];
aID = [arrStr objectAtIndex:1];
arrStr = [aID componentsSeparatedByString:@"?mt="];
aID = [arrStr objectAtIndex:0];
The above leaves me with the NSString = 368907840