Skip to content

Commit 987b5bf

Browse files
[DOC] Tweaks for String#capitalize
1 parent 482f4ca commit 987b5bf

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

string.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8282,20 +8282,29 @@ rb_str_capitalize_bang(int argc, VALUE *argv, VALUE str)
82828282

82838283
/*
82848284
* call-seq:
8285-
* capitalize(mapping) -> string
8285+
* capitalize(mapping = :ascii) -> string
82868286
*
8287-
* Returns a string containing the characters in +self+;
8288-
* the first character is upcased;
8289-
* the remaining characters are downcased:
8287+
* Returns a string containing the characters in +self+,
8288+
* each with possibly changed case:
82908289
*
8291-
* s = 'hello World!' # => "hello World!"
8292-
* s.capitalize # => "Hello world!"
8290+
* - The first character is upcased.
8291+
* - All other characters are downcased.
82938292
*
8294-
* The casing may be affected by the given +mapping+;
8295-
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc].
8293+
* Examples:
8294+
*
8295+
* 'hello world'.capitalize # => "Hello world"
8296+
* 'HELLO WORLD'.capitalize # => "Hello world"
82968297
*
8297-
* Related: String#capitalize!.
8298+
* Some characters do not have upcase and downcase, and so are not changed;
8299+
* see {Case Mapping}[rdoc-ref:case_mapping.rdoc]:
82988300
*
8301+
* '1, 2, 3, ...'.capitalize # => "1, 2, 3, ..."
8302+
*
8303+
* The casing is affected by the given +mapping+,
8304+
* which may be +:ascii+, +:fold+, or +:turkic+;
8305+
* see {Case Mappings}[rdoc-ref:case_mapping.rdoc@Case+Mappings].
8306+
*
8307+
* Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
82998308
*/
83008309

83018310
static VALUE

0 commit comments

Comments
 (0)