Skip to content

Instantly share code, notes, and snippets.

@codeswimmer
Created January 2, 2013 20:07
Show Gist options
  • Select an option

  • Save codeswimmer/4437493 to your computer and use it in GitHub Desktop.

Select an option

Save codeswimmer/4437493 to your computer and use it in GitHub Desktop.
iOS: Search A String In Array
-(void)searchString:(NSString *)str inArray:(NSArray *)arr{
for (id key in arr) {
//check if there is a matching string (key and str)
if ([key rangeOfString:str options:NSCaseInsensitiveSearch].location != NSNotFound) {
NSLog(@"String: %@ Found", key);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment