[DOC] Tweaks for String#downcase

This commit is contained in:
BurdetteLamar 2025-11-21 17:16:37 +00:00 committed by Peter Zhu
parent e5e4175dbd
commit 2491a504ff
Notes: git 2025-12-06 03:05:45 +00:00
2 changed files with 15 additions and 7 deletions

View File

@ -1,12 +1,20 @@
Returns a new string containing the downcased characters in +self+:
'Hello, World!'.downcase # => "hello, world!"
'ТЕСТ'.downcase # => "тест"
'よろしくお願いします'.downcase # => "よろしくお願いします"
'HELLO'.downcase # => "hello"
'STRAẞE'.downcase # => "straße"
'ПРИВЕТ'.downcase # => "привет"
'RubyGems.org'.downcase # => "rubygems.org"
Some characters do not have upcased and downcased versions.
Some characters (and some character sets) do not have upcase and downcase versions;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc]:
The casing may be affected by the given +mapping+;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
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}[rdoc-ref:case_mapping.rdoc@Case+Mappings].
Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].

View File

@ -8052,7 +8052,7 @@ rb_str_downcase_bang(int argc, VALUE *argv, VALUE str)
/*
* call-seq:
* downcase(mapping) -> string
* downcase(mapping = :ascii) -> new_string
*
* :include: doc/string/downcase.rdoc
*