Created
July 31, 2013 06:44
-
-
Save chiragmongia/6119869 to your computer and use it in GitHub Desktop.
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
| #Question - Replace - Regex | |
| #Ask user to enter text. Replace each vowel in the text with a '*' using regular expression. | |
| def replace_vowels_with_asterisk(input_text) | |
| input_text.gsub(/[aeiou]/i, '*') | |
| end | |
| #Main | |
| puts "Replacing Vowels with '*'" | |
| puts "Enter the text" | |
| input_text = gets.chomp | |
| puts "---Text after replacing vowels--" | |
| puts replace_vowels_with_asterisk(input_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment