Declaration:
let listArray = [\"kashif\"]
let word = \"kashif\"
then this
contains(listArray, word)
Ret
For checking if a string exists in a array with more Options(caseInsensitive, anchored/search is limited to start)
let list = ["kashif"]
let word = "Kashif"
if list.contains(where: {$0.range(of: word, options: [.caseInsensitive, .anchored]) != nil}) {
print(true) // true
}
if let index = list.index(where: {$0.range(of: word, options: [.caseInsensitive, .anchored]) != nil}) {
print("Found at index \(index)") // true
}