/ Published in: Ruby
Extends the String class to make a method that lets you easily capitalize the each word in a given string.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
class String def capitalize_each_word (self.split(' ').each {|w| w.capitalize! }).join(' ') end end