Capitalize each word in a string


#1

How do you capitalize each word in a string? Essentially, Ruby’s
version of PHP’s ucwords()? Thanks.


#2

How do you capitalize each word in a string? Essentially, Ruby’s
version of PHP’s ucwords()? Thanks.

“this is a test sentence.”.titleize

–> “This Is A Test Sentence.”

http://api.rubyonrails.com/classes/ActiveSupport/CoreExtensions/String/Inflections.html#M000281

steve.