I need to determine if a string contains any of the characters from a custom set that I have defined.
I see from this post that you can use rangeOfString to determine
You could do it this way:
var string = "Hello, World!" if string.rangeOfString("W") != nil { println("exists") } else { println("doesn't exist") } // alternative: not case sensitive if string.lowercaseString.rangeOfString("w") != nil { println("exists") } else { println("doesn't exist") }