Skip to content
instance method

String#downcase

() -> ::String
(:ascii | :fold | :lithuanian | :turkic) -> ::String
(:lithuanian, :turkic) -> ::String
(:turkic, :lithuanian) -> ::String
downcase(mapping = :ascii) → new_string

Returns a new string containing the downcased characters in self:

Example
'HELLO'.downcase        # => "hello"
'STRAẞE'.downcase       # => "straße"
'ПРИВЕТ'.downcase       # => "привет"
'RubyGems.org'.downcase # => "rubygems.org"

Some characters (and some character sets) do not have upcase and downcase versions; see Case Mapping:

Example
s = '1, 2, 3, ...'
s.downcase == s # => true
s = 'こんにちは'
s.downcase == s # => true

The casing is affected by the given mapping, which may be :ascii, :fold, or :turkic; see Case Mappings.

Related: see Converting to New String.

Ruby version changes

  1. 3.0
See also #downcase! #delete_suffix! #delete_suffix #dump also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0