From 987b5bf97289da2b1db661da5d489e4e57909c1f Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Mon, 7 Jul 2025 08:02:15 -0500 Subject: [DOC] Tweaks for String#capitalize --- string.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/string.c b/string.c index 589946c9bc..3de38ede73 100644 --- a/string.c +++ b/string.c @@ -8282,20 +8282,29 @@ rb_str_capitalize_bang(int argc, VALUE *argv, VALUE str) /* * call-seq: - * capitalize(mapping) -> string + * capitalize(mapping = :ascii) -> string * - * Returns a string containing the characters in +self+; - * the first character is upcased; - * the remaining characters are downcased: + * Returns a string containing the characters in +self+, + * each with possibly changed case: * - * s = 'hello World!' # => "hello World!" - * s.capitalize # => "Hello world!" + * - The first character is upcased. + * - All other characters are downcased. * - * The casing may be affected by the given +mapping+; - * see {Case Mapping}[rdoc-ref:case_mapping.rdoc]. + * Examples: + * + * 'hello world'.capitalize # => "Hello world" + * 'HELLO WORLD'.capitalize # => "Hello world" * - * Related: String#capitalize!. + * Some characters do not have upcase and downcase, and so are not changed; + * see {Case Mapping}[rdoc-ref:case_mapping.rdoc]: * + * '1, 2, 3, ...'.capitalize # => "1, 2, 3, ..." + * + * 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]. */ static VALUE -- cgit v1.2.3