Skip to content

Commit 14c234a

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
[DOC] Tweaks for String#prepend
1 parent 9d9390a commit 14c234a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

doc/string.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@
388388
# - #<<: Returns +self+ concatenated with a given string or integer.
389389
# - #append_as_bytes: Returns +self+ concatenated with strings without performing any
390390
# encoding validation or conversion.
391+
# - #prepend: Prefixes to +self+ the concatenation of given other strings.
391392
#
392393
# _Substitution_
393394
#
@@ -448,7 +449,6 @@
448449
# - #+: Returns the concatenation of +self+ and a given other string.
449450
# - #center: Returns a copy of +self+, centered by specified padding.
450451
# - #concat: Returns the concatenation of +self+ with given other strings.
451-
# - #prepend: Returns the concatenation of a given other string with +self+.
452452
# - #ljust: Returns a copy of +self+ of a given length, right-padded with a given other string.
453453
# - #rjust: Returns a copy of +self+ of a given length, left-padded with a given other string.
454454
#

string.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4086,15 +4086,14 @@ rb_ascii8bit_appendable_encoding_index(rb_encoding *enc, unsigned int code)
40864086

40874087
/*
40884088
* call-seq:
4089-
* prepend(*other_strings) -> string
4089+
* prepend(*other_strings) -> new_string
40904090
*
4091-
* Prepends each string in +other_strings+ to +self+ and returns +self+:
4091+
* Prefixes to +self+ the concatenation of the given +other_strings+; returns +self+:
40924092
*
4093-
* s = 'foo'
4094-
* s.prepend('bar', 'baz') # => "barbazfoo"
4095-
* s # => "barbazfoo"
4093+
* 'baz'.prepend('foo', 'bar') # => "foobarbaz"
4094+
*
4095+
* Related: see {Modifying}[rdoc-ref:String@Modifying].
40964096
*
4097-
* Related: String#concat.
40984097
*/
40994098

41004099
static VALUE

0 commit comments

Comments
 (0)