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