[DOC] Tweaks for String#upcase (#15244)

This commit is contained in:
Burdette Lamar 2025-11-20 16:03:58 -06:00 committed by GitHub
parent cb9c7a6a0a
commit 59e0489248
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2025-11-20 22:04:24 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>
2 changed files with 21 additions and 10 deletions

20
doc/string/upcase.rdoc Normal file
View File

@ -0,0 +1,20 @@
Returns a new string containing the upcased characters in +self+:
'Hello, World!'.upcase # => "HELLO, WORLD!"
The sizes of +self+ and the upcased result may differ:
s = 'Straße'
s.size # => 6
s.upcase # => "STRASSE"
s.upcase.size # => 7
Some characters (and some character sets) do not have upcased and downcased versions:
s = 'よろしくお願いします'
s.upcase == s # => true
The casing may be affected by the given +mapping+;
see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].

View File

@ -8001,16 +8001,7 @@ rb_str_upcase_bang(int argc, VALUE *argv, VALUE str)
* call-seq:
* upcase(mapping) -> string
*
* Returns a string containing the upcased characters in +self+:
*
* s = 'Hello World!' # => "Hello World!"
* s.upcase # => "HELLO WORLD!"
*
* The casing may be affected by the given +mapping+;
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
*
* Related: String#upcase!, String#downcase, String#downcase!.
*
* :include: doc/string/upcase.rdoc
*/
static VALUE