check if string in array of string swift
swift 5
your_array.contains( element )
check if string in array of string swift
swift 5
your_array.contains( element )
check if array contains value swift
//we can use the .contains element
//Declaration:
func contains(_ element: Element) -> Bool
//Thus, it accepts an array and a value, and checks if the value if present in the array
//Example:
sampleArray = ["Apple", "Berry", "Banana"]
print(sampleArray.contains("Apple"))
//The contains function checks in the sampleArray if an element called Apple exists. If it exists, it prints true.
//Therefore prints true
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us