Skip to content

Commit 51252ef

Browse files
[DOC] Tweaks for String#concat (ruby#13836)
1 parent a1acba6 commit 51252ef

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

doc/string/concat.rdoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Concatenates each object in +objects+ to +self+; returns +self+:
2+
3+
'foo'.concat('bar', 'baz') # => "foobarbaz"
4+
5+
For each given object +object+ that is an integer,
6+
the value is considered a codepoint and converted to a character before concatenation:
7+
8+
'foo'.concat(32, 'bar', 32, 'baz') # => "foo bar baz" # Embeds spaces.
9+
'те'.concat(1089, 1090) # => "тест"
10+
'こん'.concat(12395, 12385, 12399) # => "こんにちは"
11+
12+
Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].

string.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3789,19 +3789,7 @@ rb_str_concat_literals(size_t num, const VALUE *strary)
37893789
* call-seq:
37903790
* concat(*objects) -> string
37913791
*
3792-
* Concatenates each object in +objects+ to +self+ and returns +self+:
3793-
*
3794-
* s = 'foo'
3795-
* s.concat('bar', 'baz') # => "foobarbaz"
3796-
* s # => "foobarbaz"
3797-
*
3798-
* For each given object +object+ that is an Integer,
3799-
* the value is considered a codepoint and converted to a character before concatenation:
3800-
*
3801-
* s = 'foo'
3802-
* s.concat(32, 'bar', 32, 'baz') # => "foo bar baz"
3803-
*
3804-
* Related: String#<<, which takes a single argument.
3792+
* :include: doc/string/concat.rdoc
38053793
*/
38063794
static VALUE
38073795
rb_str_concat_multi(int argc, VALUE *argv, VALUE str)

0 commit comments

Comments
 (0)