Ruby on Rails uncapitalize first letter

ma11hew28 picture ma11hew28 · Dec 17, 2010 · Viewed 18.9k times · Source

I'm running Rails 2.3.2.

How do I convert "Cool" to "cool"? I know "Cool".downcase works, but is there a Ruby/Rails method that does the opposite of capitalize, i.e., uncapitalize or decapitalize?

Answer

tfischbach picture tfischbach · Oct 26, 2012

There is also:

"coolat_cat".camelize(:lower) # => "coolCat"