instance method
capitalize
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v5.2.8.1Signature
capitalize()
Converts the first character to uppercase and the remainder to lowercase.
Example:
'über'.mb_chars.capitalize.to_s #=> "Über"
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 393
def capitalize
(slice(0) || chars('')).upcase + (slice(1..-1) || chars('')).downcase
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 393
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars