I am matching an substring in my suggestion array to make a Autocomplete text field.
func searchAutocompleteEntriesWithSubstring(substring: String)
{
autocompleteUrls.removeAll(keepCapacity: false)
for curString in countries
{
let myString:NSString! = curString as NSString
let substringRange :NSRange! = myString.rangeOfString(substring)
if (substringRange.location == 0)
{
autocompleteUrls.append(curString)
}
}
autocompleteTableView.reloadData()
}
But if the country I am searching is India and I start searching from "ndia", its not getting the suggestions, it should get that as well.