Check if NSString hasPrefix that is contained in NSArray
问题 I have this if statement to check if a URL starts with a prefix: NSString *baseUrl = @"http://example.com/"; NSString *currentURL = @"http://example.com/confirm"; if( [currentURL hasPrefix:[baseUrl stringByAppendingString:@"confirm"]] ){ // True, so do something... } I would like to modify the hasPrefix part of my if statement so that it returns true if currentUrl is appended by ANY of the values in my NSArray shown here: NSArray *pages = [NSArray arrayWithObjects:@"confirm",@"products",nil];