This question already has an answer here:
- How to check if an element is in an array 14 answers
I am trying to see if my UITextField.text matches any of the strings in my array exactly. As I am using letters I need to know if the text matches exactly and not just contains elements from the array.
In the if statement I am not sure what to put after 'cameraBodies' to search over the whole array?
Thank you for any help
let cameraBodies = ["A","B","C","D","E","F","G","H","I","J","K",
"L","M","N","O","P","Q","R","S","T","U","V",
"W","X","Y","Z","Other"]
if cameraBodyTextField.text != cameraBodies (Here is the problem) {
print("Does not match")
} else {
print("Does match")
}
}
Aucun commentaire:
Enregistrer un commentaire