Method: ActiveSupport::Inflector#upcase_first
- Defined in:
- activesupport/lib/active_support/inflector/methods.rb
permalink #upcase_first(string) ⇒ Object
Converts the first character in the string to uppercase.
upcase_first('what a Lovely Day') # => "What a Lovely Day"
upcase_first('w') # => "W"
upcase_first('') # => ""
164 165 166 |
# File 'activesupport/lib/active_support/inflector/methods.rb', line 164 def upcase_first(string) string.length > 0 ? string[0].upcase.concat(string[1..-1]) : "" end |