Forum: Ruby on Rails capitalize each word in a string

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
ryan (Guest)
on 2006-03-05 10:34
How do you capitalize each word in a string?  Essentially, Ruby's
version of PHP's ucwords()?  Thanks.
Steve Clarke (Guest)
on 2006-03-05 14:06
(Received via mailing list)
> 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/C...

steve.
This topic is locked and can not be replied to.