I want to search through an array with strings in it. Therefore i use a searchbar. Here's my code:
for(NSString *string in itemsArray)
{
NSRange nameRange = [string rangeOfString:text options:NSCaseInsensitiveSearch];
if (nameRange.location != NSNotFound)
{
[filteredItemsArray addObject:string];
}
}
It works great, but the problem is it just finds the string when I write it exactly the same way (except the case insensitivity). But I would also like to find it even if the strings doesn't fit a 100%. For example when I search for 'Ralle Turner' it should also find the string with 'Ralle/Ralph Turner'.
Thanks for your help guys!