Skip to content

Instantly share code, notes, and snippets.

@mikekavouras
Created January 7, 2016 00:41
Show Gist options
  • Select an option

  • Save mikekavouras/9d560b253989837c46eb to your computer and use it in GitHub Desktop.

Select an option

Save mikekavouras/9d560b253989837c46eb to your computer and use it in GitHub Desktop.
func VowelRemover(str: String) -> String {
let vowels: [Character] = ["a", "e", "i", "o", "u"]
let chars = str.characters.filter { !vowels.contains($0) }.map { String($0) }
return chars.joinWithSeparator("")
// 1 liner
// str.characters.filter { !["a", "e", "i", "o", "u"].contains($0) }.map { String($0) }.joinWithSeparator("")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment