Skip to content

Instantly share code, notes, and snippets.

@RickGriff
Last active January 8, 2018 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RickGriff/7ab6ac471a4c477ef87a1eef2f0a3f1b to your computer and use it in GitHub Desktop.
Save RickGriff/7ab6ac471a4c477ef87a1eef2f0a3f1b to your computer and use it in GitHub Desktop.
Codewars Challenge: Disemvowel Trolls
# Trolls are attacking your comment section!
# A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat.
# Your task is to write a function that takes a string and return a new string with all vowels removed.
# For example, the string "This website is for losers LOL!" would become "Ths wbst s fr lsrs LL!".
# Note: for this kata y isn't considered a vowel.
-----
#My Solution:
def disemvowel(str)
vowels = "aeiou"
letters = str.split("")
letters.select { |letter| !vowels.include? letter.downcase }.join("")
end
#PS: Realized I can use the String#delete method to do this more simply!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment