In Swift 3, I want to create an array of matching string (case insensitive) from string array:-
I am using this code, but it is case sensitive,
let filteredArray = self.arrCountry.filter { $0.contains("india") }
how can I do this.. suppose I have a master string array called arrCountry, I want to create other array of all the string who has "india"(case insensitive) in it.
Can anyone help me out.
It's better to use
Answer 2020:
Even I put Chinese or Arabic, below test codes still returns TRUE
The easiest way might be to lowercase your strings and compare:
Swift 3 and above
You can try with
localizedCaseInsensitiveContains