Skip to content

Instantly share code, notes, and snippets.

@rangerscience
Created June 20, 2011 07:40
Show Gist options
  • Save rangerscience/1035267 to your computer and use it in GitHub Desktop.
Save rangerscience/1035267 to your computer and use it in GitHub Desktop.
"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