I want to avoid the if statement in the sample code below, and instead make a single call to hasPrefix on my number string and pass in the prefixes array. Is there a way to do this in Swift?
let prefixes: [String] = ["212", "213", "214"]
let number: String = "213-555-1212"
if number.hasPrefix("212") || number.hasPrefix("213") {
print("found")
}