Skip to content

Instantly share code, notes, and snippets.

@Pasanpr
Created February 16, 2017 17:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Pasanpr/26e6e6227e62b7330a09a825c02a612f to your computer and use it in GitHub Desktop.
Save Pasanpr/26e6e6227e62b7330a09a825c02a612f to your computer and use it in GitHub Desktop.
Determine if a character is a vowel or not
extension Character {
var isVowel: Bool {
let vowels: [Character] = ["a", "e", "i", "o", "u"]
return vowels.contains(self)
}
}
@IsaacRichardson
Copy link

func removeVowels(from value: String) -> String {
    var vowels: [Character] = ["a", "e", "i", "o", "u"]
    
    var newValue = value.lowercased()
    
    newValue.removeAll(where: { vowels.contains($0) })

    return newValue
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment