[DOC] Tweaks for String#concat (#13836)

This commit is contained in:
Burdette Lamar 2025-07-10 09:40:49 -05:00 committed by GitHub
parent a1acba6d14
commit 51252ef8d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 13 deletions

12
doc/string/concat.rdoc Normal file
View file

@ -0,0 +1,12 @@
Concatenates each object in +objects+ to +self+; returns +self+:
'foo'.concat('bar', 'baz') # => "foobarbaz"
For each given object +object+ that is an integer,
the value is considered a codepoint and converted to a character before concatenation:
'foo'.concat(32, 'bar', 32, 'baz') # => "foo bar baz" # Embeds spaces.
'те'.concat(1089, 1090) # => "тест"
'こん'.concat(12395, 12385, 12399) # => "こんにちは"
Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].

View file

@ -3789,19 +3789,7 @@ rb_str_concat_literals(size_t num, const VALUE *strary)
* call-seq: * call-seq:
* concat(*objects) -> string * concat(*objects) -> string
* *
* Concatenates each object in +objects+ to +self+ and returns +self+: * :include: doc/string/concat.rdoc
*
* s = 'foo'
* s.concat('bar', 'baz') # => "foobarbaz"
* s # => "foobarbaz"
*
* For each given object +object+ that is an Integer,
* the value is considered a codepoint and converted to a character before concatenation:
*
* s = 'foo'
* s.concat(32, 'bar', 32, 'baz') # => "foo bar baz"
*
* Related: String#<<, which takes a single argument.
*/ */
static VALUE static VALUE
rb_str_concat_multi(int argc, VALUE *argv, VALUE str) rb_str_concat_multi(int argc, VALUE *argv, VALUE str)