Timeline for Replacing the vowels of a string with the letter "X"
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 27, 2017 at 3:00 | comment | added | akuhn |
Best use << for string concatenation inside reduce loop. Using += will create a new object for each iteration.
|
|
Dec 28, 2016 at 21:22 | comment | added | Joana B | This is interesting - 40 years is a lot!! I just wished it had another way of handling uppercase letters : ) | |
Dec 28, 2016 at 21:11 | comment | added | Flambino |
@JoanaB Yeah, tr is often overlooked - even though it's actually old as dirt: Its name comes from a standard unix/linux command line program also called tr . Don't know when the CLI program appeared but I'm guessing ~40 years ago
|
|
Dec 28, 2016 at 21:05 | comment | added | Joana B | Thank you @Flambino, it's the first time I'm hearing about #tr(it will be very useful from now on). Yes definitely, using #tr is easier than using regular expressions. | |
Dec 28, 2016 at 20:58 | comment | added | Flambino |
@JoanaB Yeah, regular expressions are incredibly useful, though in this case String#tr does the job just as well, without the (admittedly negligible) overhead of regex. Replacing characters in a string is precisely what tr is built for; using regex is pretty overkill
|
|
Dec 28, 2016 at 20:54 | comment | added | Joana B | Wow, thank you @Flambino! You are right, using a regular expression in this case is better!! | |
Dec 28, 2016 at 20:50 | history | edited | Flambino | CC BY-SA 3.0 |
added 863 characters in body
|
Dec 28, 2016 at 20:43 | history | answered | Flambino | CC BY-SA 3.0 |