I want to search a string in array and get all indexes at which string is present.
My Array consisting of json data coming from server is.
["Non Native", "Native", "Native & Non Native"]
The method I am using is
let indexArray = demand.indices.filter {
demand[$0].localizedCaseInsensitiveContains("Native")
}
print(indexArray)
But my problem is I get all of the three indexes. I just want only Native indexes (as in this case second index). (As much as I searched although it is part of other indexes too). Any help will be highly appreciated.
localizedCaseInsensitiveContains, then sure, all three of three of them contain "Native". That is what "contain" means.