Ruby on Rails uncapitalize first letter Ruby on Rails uncapitalize first letter ruby ruby

Ruby on Rails uncapitalize first letter


There is also:

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


There is no inverse of capitalize, but you can feel free to roll your own:

class String  def uncapitalize     self[0, 1].downcase + self[1..-1]  endend


You could also do this with a simple sub:

"Cool".sub(/^[A-Z]/) {|f| f.downcase }