mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[DOC] Tweaks for String#concat (#13836)
This commit is contained in:
parent
a1acba6d14
commit
51252ef8d7
2 changed files with 13 additions and 13 deletions
12
doc/string/concat.rdoc
Normal file
12
doc/string/concat.rdoc
Normal 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].
|
14
string.c
14
string.c
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue