Last active
January 8, 2018 12:30
-
-
Save RickGriff/7ab6ac471a4c477ef87a1eef2f0a3f1b to your computer and use it in GitHub Desktop.
Codewars Challenge: Disemvowel Trolls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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