Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jrodriguez-ifuelinteractive/4d016370a7a4dc8eca0b to your computer and use it in GitHub Desktop.
Save jrodriguez-ifuelinteractive/4d016370a7a4dc8eca0b to your computer and use it in GitHub Desktop.
Search within an NSString
NSString *string = @"Hello Bla Bla";
NSString *searchText = @"bla";
NSUInteger searchOptions = NSCaseInsensitiveSearch | NSDiacriticInsensitiveSearch;
NSRange searchRange = NSMakeRange(0, string.length);
NSRange foundRange = [string rangeOfString:searchText options:searchOptions range:searchRange];
if (foundRange.length > 0) {
NSLog(@"Text Found.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment