Array找值/從集合找尋成員
單純尋找Array裡面是否有值回傳Bool
尋找Array裡面是否有值回傳Index
測試資料Array
var testList = ["測試1","測試2","測試3","測試4","測試5"]
尋找值回傳Bool
if testList.contains("測試2"){
print("找到了")
}
尋找值並回傳Index
if let index = testList.firstIndex(of: "測試2"){
print(index)
}