Skip to content

Instantly share code, notes, and snippets.

@darcwader
Created October 29, 2017 13:54
Show Gist options
  • Select an option

  • Save darcwader/3d7168d51fc225e9b5a85d45c68fd4b0 to your computer and use it in GitHub Desktop.

Select an option

Save darcwader/3d7168d51fc225e9b5a85d45c68fd4b0 to your computer and use it in GitHub Desktop.
func tokenize(_ message:String) -> [String] {
let trimmed = message.lowercased().trimmingCharacters(in: CharacterSet(charactersIn: "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"))
let tokens = trimmed.components(separatedBy: CharacterSet.whitespaces)
return tokens
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment