func removeCharactersNotInSetFromText(text: String, set: Set<Character>) -> String {
return String(text.characters.filter { set.contains( $0) })
}
let text = "Swift 3.0 Come Out"
var chars = Set([Character]("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLKMNOPQRSTUVWXYZ".characters))
let newText = removeCharactersNotInSetFromText(text, set: chars) // "SwiftComeOut"
func removeCharactersNotInSetFromText(text: String, set: Set<Character>) -> String {
return String(text.characters.filter { set.contains( $0) })
}
let text = "Swift 3.0 Come Out"
var chars = Set([Character]("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLKMNOPQRSTUVWXYZ".characters))
let newText = removeCharactersNotInSetFromText(text: text, set: chars)