Created
June 20, 2011 07:40
-
-
Save rangerscience/1035267 to your computer and use it in GitHub Desktop.
This file contains 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
"WORD WORD WORD/WORD WORD-WORD".split(" ").each | |
{ | |
|w| w.split("/").each | |
{ | |
|w| w.split("-").each | |
{ | |
|w| w.capitalize! | |
} | |
.join("-") | |
} | |
.join("/") | |
} | |
.join(" ") | |
#Trying to get out: | |
"Word Word Word/Word Word-Word" | |
#One-liner: | |
"WORD WORD WORD/WORD WORD-WORD".split(" ").each{|w| w.split("/").each{|w| w.split("-").each{|w| w.capitalize!}.join("-")}.join("/")}.join(" ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment