defdisemvowel(string):"""Removes all occurences of vowel from the string. Args: string (str): The input string. Returns: temp_string (str): The resultant string with vowels removed. """final_string=""foriinstring:ifi.lower()in["a","e","i","o","u"]:continueelse:final_string+=ireturnfinal_stringif__name__=='__main__':print(disemvowel("This website is for losers LOL!"),"Ths wbst s fr lsrs LL!")
# Remove all vowels ('y' not included) from a string.## @param [String] the string to strip vowels from## @return [String] the resulting stringdefdisemvowel(str)str.split('').select{|ch|!ch.match(/^[aeiou]$/i)}.join('')endputsdisemvowel("This website is for losers LOL!")putsdisemvowel("No newbies allowed, go to #beginners")putsdisemvowel("LULZ TROLLED")
He/Him/His I'm a Software Engineer and a teacher. There's no feeling quite like the one you get when you watch someone's eyes light up learning something they didn't know.
In C#
Or may be just
var cleaned = Regex.Replace(input,"[aeiou]", "", RegexOptions.IgnoreCase);
Nice One!
In Ts:
Python solution.
you could use
regex
to keep it simple :)I am yet to study about regexes :)
Here's a Ruby submission!
Here's a link to the Repl.it: repl.it/@rburmorrison/DevToChallen...
Elm
Example.
Standard ML of New Jersey Solution
Ruby:
Liquid syntax error: Unknown tag 'def'
Some unfancy Common Lisp:
Python solution 🐍
JS
const disemvowel = (str) => str.replace(/[aeoiu]/gi, '');