[Feature #3675] String#prepend, String#>>

Feature #3675: String#prepend, String#>>
http://redmine.ruby-lang.org/issues/show/3675

e$B5/I<<Te(B: Sora H.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal

sorahe$B$G$9e(B.

e$BDL>oe(B, Stringe$B$G$NJ8;zNs$r<jA0$KGK2uE*$K2C$($k$N$Oe(B, a = “foo”

  • a e$BEy$G9T$$$^$9$,e(B,
    e$BD>46$GFI$_$K$/$/e(B, e$B5-9f$J$I$G=q$-$K$/$/$J$C$F$$$k$H;W$$$^$9e(B.

e$B$J$N$Ge(B, String#prepende$B$He(B String#>>
e$B$rDI2C$9$k$H$$$&$N$O$I$&$G$7$g$&$+e(B.

e$B$=$l$>$l0J2<$N$h$&$K5!G=$7$^$9e(B.

a = “bar”
a.prepend(“foo”) #=> “foobar”
p a #=> “foobar”

b = “bar”
“foo” >> b #=> “foobar”
p b #=> “foobar”

patche$B$O$3$A$i$G$9e(B (git diff [email protected]@.e(B):

diff --git string.c string.c
index 0aa2e6c…6c9be57 100644
— string.c
+++ string.c
@@ -2055,6 +2055,43 @@ rb_str_concat(VALUE str1, VALUE str2)
}
}

+/*

    • call-seq:
    • str.prepend(other_str)  -> str
      
    • Prepend—Prepend the given string to str.
    • a = “world”
    • a.prepend("hello ") #=> “hello world”
    • a #=> “hello world”
  • */

+static VALUE
+rb_str_prepend(VALUE str, VALUE str2)
+{

  • StringValue(str2);
  • StringValue(str);
  • rb_str_update(str, 0L, 0L, str2);
  • return str;
    +}

+/*

    • call-seq:
    • str >> other_str -> other_str
      
    • Prepend—Prepend self string to other_str.
    • a = “world”
    • "hello " >> a #=> “hello world”
    • a #=> “hello world”
  • */

+static VALUE
+rb_str_prepend_to_another(VALUE str1, VALUE str2)
+{

  • return rb_str_prepend(str2, str1);
    +}

st_index_t
rb_memhash(const void *ptr, long len)
{
@@ -7524,6 +7561,8 @@ Init_String(void)
rb_define_method(rb_cString, “reverse!”, rb_str_reverse_bang, 0);
rb_define_method(rb_cString, “concat”, rb_str_concat, 1);
rb_define_method(rb_cString, “<<”, rb_str_concat, 1);

  • rb_define_method(rb_cString, “prepend”, rb_str_prepend, 1);
  • rb_define_method(rb_cString, “>>”, rb_str_prepend_to_another, 1);
    rb_define_method(rb_cString, “crypt”, rb_str_crypt, 1);
    rb_define_method(rb_cString, “intern”, rb_str_intern, 0);
    rb_define_method(rb_cString, “to_sym”, rb_str_intern, 0);
    diff --git test/ruby/test_string.rb test/ruby/test_string.rb
    index 02271ce…da2477f 100644
    — test/ruby/test_string.rb
    +++ test/ruby/test_string.rb
    @@ -1882,4 +1882,36 @@ class TestString < Test::Unit::TestCase
    assert_equal(’"\u3042\u3044\u3046"’,
    “\u3042\u3044\u3046”.encode(e).inspect)
    end
    end
  • def test_prepend_to_another
  • assert_equal(S(“hello world”), "hello " >> “world”)
  • foo = Object.new
  • def foo.to_str
  •  "b"
    
  • end
  • assert_equal(S(“ab”), “a” >> foo)
  • a = S(“world!”)
  • b = S("hello ")
  • b >> a
  • assert_equal(S(“hello world!”), a)
  • assert_equal(S("hello "), b)
  • end
  • def test_prepend
  • assert_equal(S(“hello world!”), “world!”.prepend("hello "))
  • foo = Object.new
  • def foo.to_str
  •  "b"
    
  • end
  • assert_equal(S(“ba”), “a”.prepend(foo))
  • a = S(“world”)
  • b = S("hello ")
  • a.prepend(b)
  • assert_equal(S(“hello world”), a)
  • assert_equal(S("hello "), b)
  • end
    end

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:41969] [Feature #3675] String#prepend,
String#>>”
on Tue, 10 Aug 2010 18:24:04 +0900, Sora H.
[email protected] writes:

|sorahe$B$G$9e(B.
|
|e$BDL>oe(B, Stringe$B$G$NJ8;zNs$r<jA0$KGK2uE*$K2C$($k$N$Oe(B, a = “foo” + a e$BEy$G9T$$$^$9$,e(B,
|e$BD>46$GFI$_$K$/$/e(B, e$B5-9f$J$I$G=q$-$K$/$/$J$C$F$$$k$H;W$$$^$9e(B.

e$B$3$l$OGK2uE*$G$O$J$$$G$9$M!#e(Bae$B$K:G=iF~$C$F$$$?J8;zNs$OJQ99$5e(B
e$B$l$:$K;D$j$^$9!#e(B

|e$B$J$N$Ge(B, String#prepende$B$He(B String#>> e$B$rDI2C$9$k$H$$$&$N$O$I$&$G$7$g$&$+e(B.

e$BHs>o$K6=L#?<$$$G$9!#[email protected]!"$$$/[email protected]$,$"$j$^$9!#e(B

(1)
e$Be$N$3$H$G$9$,!"e(Bappende$B$H0[$J$j!"e(Bprepende$B$O!"J8;zNsNN0he(B
e$B$r3HD%$7$?>e$G!“8=:_$NJ8;zNs$NFbMF$r%3%T!<$7!”$=$l$+$i0ze(B
[email protected],$+$i%3%T!<$9$k$3$H$K$J$j$^$9!#$D$^$j!"e(B

 a = "foo" + a

e$B$HHf3S$7$F!"%3%9%H$O%*%V%8%'%/%H%"%m%1!<%7%g%s$R$H$D$7$+e(B
e$BJQ$o$j$^$;$s!#$=$l$,K\Ev$K$&$l$7$$$+$d$d5?Ld$G$9!#$b$C$He(B
e$B$bD9$$L\$G8+$k$He(BGCe$B$X$NIi2Y$,7Z$$$H$$$&%a%j%C%H$,=P$k%1!<e(B
e$B%9$b$"$k$G$7$g$&!#e(B

(2) >> e$B$H$$$&$N$O9M$($F$b$_$J$+$C$?LLGr$$5-K!$G$9!#$7$+$7!"e(B
e$B8=>u$NJ8;zNs$N%a%=%C%I$G!“0z?t$N$[$&$KGK2uE*$JJQ99$r2C$(e(B
e$B$k%a%=%C%I$O$J$+$C$?$h$&$K;W$&$N$G!”$d$dm4m0$7$^$9!#$b$Ce(B
e$B$H$b!"e(BStringe$B%/%i%9$G$J$1$l$P!“0z?t$KGK2uE*$JJQ99$r2C$($ke(B
e$B%a%=%C%I$O$$$/$D$b$”$k$N$G!"5$$K$9$k$3$H$G$O$J$$$N$+$b$7e(B
e$B$l$^$;$s!#e(B

e$BB>$NJ}$N$40U8+$bJ9$-$?$$$G$9!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

sorahe$B$G$9e(B.

2010/8/10 Yukihiro M. [email protected]:

e$B$HHf3S$7$F!"%3%9%H$O%%V%8%’%/%H%"%m%1!<%7%g%s$R$H$D$7$+e(B
e$BJQ$o$j$^$;$s!#$=$l$,K\Ev$K$&$l$7$$$+$d$d5?Ld$G$9!#$b$C$He(B
e$B$bD9$$L$G8+$k$He(BGCe$B$X$NIi2Y$,7Z$$$H$$$&%a%j%C%H$,=P$k%1!<e(B
e$B%9$b$"$k$G$7$g$&!#e(B
e$B8D?ME
$K$Oe(Ba = “foo” + ae$B$h$je(B"foo" >>
ae$B$de(B"foo".prepende$B$N$[$&$,FI$_$d$9$$$H;W$&$N$G$9$h$Me(B…

e$B$"$H$O>/$7%Y%s%A%^!<%/$r9T$C$F$_$^$7$?$,e(B, String#prepend,
String#>>e$B$Oe(B
e$B$$$:$l$be(B a = “foo” + ae$B$h$jAa$$$h$&$K8+$($^$7$?e(B.

(2) >> e$B$H$$$&$N$O9M$($F$b$_$J$+$C$?LLGr$$5-K!$G$9!#$7$+$7!"e(B
e$B8=>u$NJ8;zNs$N%a%=%C%I$G!“0z?t$N$[$&$KGK2uE*$JJQ99$r2C$(e(B
e$B$k%a%=%C%I$O$J$+$C$?$h$&$K;W$&$N$G!”$d$dm4m0$7$^$9!#$b$Ce(B
e$B$H$b!"e(BStringe$B%/%i%9$G$J$1$l$P!“0z?t$KGK2uE*$JJQ99$r2C$($ke(B
e$B%a%=%C%I$O$$$/$D$b$”$k$N$G!“5$$K$9$k$3$H$G$O$J$$$N$+$b$7e(B
e$B$l$^$;$s!#e(B
e$B$3$N%Q%C%A$O2?EY$+e(BIRCe$B$N$[$&[email protected]$7$F$$$?$N$G$9$,e(B,
e$BF1$8$h$&$J;[email protected]$o$l$^$7$?e(B. e$B<+J,$OB>$N%/%i%9$K$”$k$N$J$ie(B
e$BJL$K$$$$$N$G$O$J$$$+$H;W$$$^$9$,e(B…

[email protected],5A$G$9!#$3$s$K$A$O!#e(B

2010e$BG/e(B8e$B7ne(B11e$BF|e(B10:20 U.Nakamura [email protected]:

e$B71N}$5$l$?e(BRubyiste$B$Oe(B>>e$B$r%a%=%C%I$H$7$F8+$F$7$^$&$N$G!V0z?t$NJ}e(B
e$B$KGK2uE*$JJQ99$r2C$($k!W$H;W$C$F$7$^$&$o$1$G$9$,!";[email protected]$18+e(B
e$B$l$P1&9`$,JQ99$5$l$k$N$O3d$HAGD>$J2r<a$J$s$8$c$J$$$+$H;W$$$^e(B
e$B$9!#e(B
e$B$H$$$&$o$1$G!"0-$/$J$$$s$8$c$J$$$G$7$g$&$+!#e(B

e$B71N}$5$l$F$$$k$+$I$&$+$O$5$F$*$-!"AGD>$J2r<a$H$7$F$O!"e(BString#<<e$B$H$Ne(B
e$BBPHf$,5$$K$J$j$^$9!#e(B
e$B8=>u!"e(B

a = “aaa”
b = “bbb”
c = “ccc”
d = a << b << c
p [a,b,c,d] #=> [“aaabbbccc”, “bbb”, “ccc”, “aaabbbccc”]

e$B$H$J$k$o$1$G$9$,!"e(B

x = “xxx”
y = “yyy”
z = “zzz”
w = x >> y >> z
p [x,y,z,w]

e$B$Oe(B
[“xxx”, “xxxyyy”, “xxxyyyzzz”, “xxxyyyzzz”]
e$B$H$J$k$N$G$7$g$&$+!)e(B
e$B$J$s$H$J$/!“e(B
[“xxx”, “yyy”, “xxxyyyzzz”, “xxxyyyzzz”]
e$B$H$J$C$F$[$7$$$h$&$J5$$b$9$k$N$G$9$,!”$=$&$9$k$H7k9g%k!<%kE*$Ke(B
e$B:$$C$?46$8$G$7$g$&$+!#e(B

e$B$G$b!"e(Bye$B$,GK2u$5$l$k$N$b7A$H$7$F$O<+A3$J$s$G$9$+$M$(!#$A$g$C$He(B
e$BH=CG$7$E$i$$$H$3$m$G$9!#e(B

[email protected],5Ae(B

e$B$`$i$?$G$9!#e(B

On 2010/08/11, at 12:57, masayoshi takahashi wrote:

e$BB>$NJ}$N$40U8+$bJ9$-$?$$$G$9!#e(B

z = “zzz”

e$B$G$b!"e(Bye$B$,GK2u$5$l$k$N$b7A$H$7$F$O<+A3$J$s$G$9$+$M$(!#$A$g$C$He(B
e$BH=CG$7$E$i$$$H$3$m$G$9!#e(B

e$B;d$Oe(B >> e$B$O%7%U%H1i;;;R$Ge(B << e$B$HF1$8$/:[email protected]$+$ie(B (x >>
y) >> z e$B$N=g$Ge(B
e$BI>2A$5$l$k$H<0$r8+$?=V4V$KH=CG$7!"e(By e$B$be(B z
e$B$bGK2u$5$l$k7k2L$r4|BT$7$^$7$?!#e(B

e$B;d$,e(B Rubyist e$B$H$7$F$h$j$be(B C/C++
e$B%W%m%0%i%^!<$H$7$F71N}$5$l$F$$$k=j0Y$+$b$7$l$^$;$s!#e(B


Kenta M.
OpenPGP FP = 1D69 ADDE 081C 9CC2 2E54 98C1 CEFE 8AFB 6081 B062

e$BK$r=q$-$^$7$?e(B!!
e$B!Xe(BRuby e$B5U0z$-%l%7%T!Ye(B
http://www.amazon.co.jp/dp/4798119881/mrkn-22

E-mail: [email protected]
twitter: http://twitter.com/mrkn/
blog: http://d.hatena.ne.jp/mrkn/

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:41976] Re: [Feature #3675] String#prepend,
String#>>”
on Aug.10,2010 22:23:13, [email protected] wrote:

(2) >> e$B$H$$$&$N$O9M$($F$b$_$J$+$C$?LLGr$$5-K!$G$9!#$7$+$7!"e(B
e$B8=>u$NJ8;zNs$N%a%=%C%I$G!“0z?t$N$[$&$KGK2uE*$JJQ99$r2C$(e(B
e$B$k%a%=%C%I$O$J$+$C$?$h$&$K;W$&$N$G!”$d$dm4m0$7$^$9!#$b$Ce(B
e$B$H$b!"e(BStringe$B%/%i%9$G$J$1$l$P!“0z?t$KGK2uE*$JJQ99$r2C$($ke(B
e$B%a%=%C%I$O$$$/$D$b$”$k$N$G!"5$$K$9$k$3$H$G$O$J$$$N$+$b$7e(B
e$B$l$^$;$s!#e(B

e$BB>$NJ}$N$40U8+$bJ9$-$?$$$G$9!#e(B

e$B71N}$5$l$?e(BRubyiste$B$Oe(B>>e$B$r%a%=%C%I$H$7$F8+$F$7$^$&$N$G!V0z?t$NJ}e(B
e$B$KGK2uE*$JJQ99$r2C$($k!W$H;W$C$F$7$^$&$o$1$G$9$,!";[email protected]$18+e(B
e$B$l$P1&9`$,JQ99$5$l$k$N$O3d$HAGD>$J2r<a$J$s$8$c$J$$$+$H;W$$$^e(B
e$B$9!#e(B
e$B$H$$$&$o$1$G!"0-$/$J$$$s$8$c$J$$$G$7$g$&$+!#e(B

e$B$=$l$G$O!#e(B

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:41994] Re: [Feature #3675] String#prepend,
String#>>”
on Aug.11,2010 12:57:45, [email protected] wrote:

[“xxx”, “yyy”, “xxxyyyzzz”, “xxxyyyzzz”]
e$B$H$J$C$F$[$7$$$h$&$J5$$b$9$k$N$G$9$,!"$=$&$9$k$H7k9g%k!<%kE*$Ke(B
e$B:$$C$?46$8$G$7$g$&$+!#e(B

e$B$G$b!"e(Bye$B$,GK2u$5$l$k$N$b7A$H$7$F$O<+A3$J$s$G$9$+$M$(!#$A$g$C$He(B
e$BH=CG$7$E$i$$$H$3$m$G$9!#e(B

e$B$=$NJU$O;d$b5$$K$J$j$^$7$?!#e(B
e$B$,!“7k9gB’$r$$$8$k$H$3$m$^$GF’$_9~$`$N$O$A$g$C$HI]$$$G$9$M!#e(B
e$B$d$C$Q$j<B;HMQNc$,=P$F$3$J$$$H9M;!$,?J$^$J$$$+$J$”!#e(B

e$B$=$l$G$O!#e(B

sorahe$B$G$9!#e(B

e$B7k9gK!B’$r$$$8$k$HJL%a%=%C%I$K$b1F6A$r5Z$$7$+$M$J$$e(B
(Integere$B$Ne(B>>) e$B$N$G!"e(B
e$B$3$N%a%=%C%I$N<BAu$rJQ$($k$3$H$K$J$k$H;W$&$N$G$9$,!"e(B
e$B<+J,$O$I$N$h$&$K<BAu$9$Y$-$J$N$+$,$o$+$j$^$;$s!#e(B


Sora H. (iPad) - @sora_h
Blog: http://codnote.net
Detail: http://sorah.cosmio.net

e$B$`$i$?$G$9!#e(B

On 2010/08/10, at 22:23, Yukihiro M. wrote:

e$B$bD9$$L$G8+$k$He(BGCe$B$X$NIi2Y$,7Z$$$H$$$&%a%j%C%H$,=P$k%1!<e(B
e$B%9$b$"$k$G$7$g$&!#e(B

a >> b e$B$rFbItE*$Ke(B

(i) a.length e$B$r0];}$7$?$^$^e(B a << b e$B$9$ke(B
(ii) b e$B$N%]%$%s%?$re(B a e$B$H6&M-$7!"e(B
b.length = a.length + b.length e$B$H99?7$9$k!#e(B

e$B$3$&$9$k$He(B a = “foo” + a e$B$HF1DxEY$N7W;;NL$G!"e(B
a >> b e$B$N5-K!$r<B8=$G$-$k$H;W$$$^$7$?!#e(B


Kenta M.
OpenPGP FP = 1D69 ADDE 081C 9CC2 2E54 98C1 CEFE 8AFB 6081 B062

e$BK$r=q$-$^$7$?e(B!!
e$B!Xe(BRuby e$B5U0z$-%l%7%T!Ye(B
http://www.amazon.co.jp/dp/4798119881/mrkn-22

E-mail: [email protected]
twitter: http://twitter.com/mrkn/
blog: http://d.hatena.ne.jp/mrkn/

[email protected]$G$9!#e(B

At Thu, 12 Aug 2010 09:24:29 +0900,
Kenta M. wrote in [ruby-dev:42008]:

a >> b e$B$rFbItE*$Ke(B

(i) a.length e$B$r0];}$7$?$^$^e(B a << b e$B$9$ke(B
(ii) b e$B$N%]%$%s%?$re(B a e$B$H6&M-$7!"e(B
b.length = a.length + b.length e$B$H99?7$9$k!#e(B

Copy-on-Writee$B2=$r?J$a$l$P2DG=$G$9$,!"$=$NBe$o$je(BRSTRING_PTRe$B$,e(B
null-terminatee$B$5$l$F$$$J$$%1!<%9$,=P$F$-$^$9!#8=:_$G$be(B
StringValueCStr()e$B$r8F$P$J$$8B$j$OJ]>Z$O$5$l$J$$$N$G$9$,!"@N$NA0e(B
e$BDs$N$^$^0MB8$7$F$$$k3HD%%i%$%V%i%[email protected]$,I,MW$G$"$j!"$I$NDxEY1Fe(B
e$B6A$,$"$k$+M=B,$G$-$^$;$s!#e(B

e$BIaDL$K8=:_$N<[email protected]$a$J$N$G$9$+e(B.

2010/8/12 Kenta M. [email protected]:

e$B$`$i$?$G$9!#e(B

On 2010/08/18, at 8:32, Sora H. wrote:

e$BIaDL$K8=:_$N<[email protected]$a$J$N$G$9$+e(B.

e$B8=:_$N<BAu$rH]Dj$9$k$b$N$G$O$"$j$^$;$s!#e(B

On 2010/08/10, at 22:23, Yukihiro M. wrote:

e$BHs>o$K6=L#?<$$$G$9!#[email protected]!"$$$/[email protected]$,$"$j$^$9!#e(B

(1) e$Be$N$3$H$G$9$,!"e(Bappende$B$H0[$J$j!"e(Bprepende$B$O!"J8;zNsNN0he(B
e$B$r3HD%$7$?>e$G!“8=:_$NJ8;zNs$NFbMF$r%3%T!<$7!”$=$l$+$i0ze(B
[email protected],$+$i%3%T!<$9$k$3$H$K$J$j$^$9!#e(B

[email protected]$N0l$D$H$7$FDs<([email protected]$1$G$9!#e(B

e$BCfED$5$s$,e(B [ruby-dev:42010] e$B$Ge(B

On 2010/08/12, at 12:46, Nobuyoshi N. wrote:

Copy-on-Writee$B2=$r?J$a$l$P2DG=$G$9$,!"$=$NBe$o$je(BRSTRING_PTRe$B$,e(B
null-terminatee$B$5$l$F$$$J$$%1!<%9$,=P$F$-$^$9!#8=:_$G$be(B
StringValueCStr()e$B$r8F$P$J$$8B$j$OJ]>Z$O$5$l$J$$$N$G$9$,!"@N$NA0e(B
e$BDs$N$^$^0MB8$7$F$$$k3HD%%i%$%V%i%[email protected]$,I,MW$G$"$j!"$I$NDxEY1Fe(B
e$B6A$,$"$k$+M=B,$G$-$^$;$s!#e(B

e$B$H6D$C$F$$$k$h$&$K!“J8;zNs$r6&M-$5$;$k$He(B Ruby e$B$N=hM}7O<+?H$de(B
e$B3HD%%i%$%V%i%j$KBg$-$J1F6A$rM?$([email protected]$,$”$C$F!"e(B
e$B<[email protected]$^$;$s!#e(B


Kenta M.
OpenPGP FP = 1D69 ADDE 081C 9CC2 2E54 98C1 CEFE 8AFB 6081 B062

e$BK$r=q$-$^$7$?e(B!!
e$B!Xe(BRuby e$B5U0z$-%l%7%T!Ye(B
http://www.amazon.co.jp/dp/4798119881/mrkn-22

E-mail: [email protected]
twitter: http://twitter.com/mrkn/
blog: http://d.hatena.ne.jp/mrkn/

At Tue, 10 Aug 2010 22:23:13 +0900,
matz wrote:

と比較して、コストはオブジェクトアロケーションひとつしか
変わりません。それが本当にうれしいかやや疑問です。もっと
も長い目で見るとGCã¸ã®è² è·ãŒè»½ã„ã¨ã„ã†ãƒ¡ãƒªãƒƒãƒˆãŒå‡ºã‚‹ã‚±ãƒ¼
スもあるでしょう。

今でもオブジェクト生成を避けたいのなら

a[0,0] = "foo"

でいいはず。

もちろん、若干遅いでしょうが正規表現を使うのもあり。

a[/^/] = "foo"  # ふつうの人
a[/\A/] = "foo"  # å ±ã‚ã‚Œãªã„åŽŸç†ä¸»ç¾©è€…
a[//]="foo"    # ゴルファー

(2) >> というのは考えてもみなかった面白い記法です。しかし、
ç¾çŠ¶ã®æ–‡å­—åˆ—ã®ãƒ¡ã‚½ãƒƒãƒ‰ã§ã€å¼•æ•°ã®ã»ã†ã«ç ´å£Šçš„ãªå¤‰æ›´ã‚’åŠ ãˆ
るメソッドはなかったように思うので、やや躊躇します。もっ
とも、Stringã‚¯ãƒ©ã‚¹ã§ãªã‘ã‚Œã°ã€å¼•æ•°ã«ç ´å£Šçš„ãªå¤‰æ›´ã‚’åŠ ãˆã‚‹
メソッドはいくつもあるので、気にすることではないのかもし
れません。

String#>> だと、レシーバが文字列かそのサブクラスのインスタンス
限定になるので #to_str を持った文字列もどきはダメということに
なりますね。x.to_str + s も切なくて “#{x}s” としたりもするので、
s が殿様な感じがする x.to_str >> s は嫌かも(笑)。

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:42061] Re: [Feature #3675] String#prepend,
String#>>”
on Wed, 18 Aug 2010 13:31:13 +0900, “Akinori MUSHA”
[email protected] writes:

|String#>> [email protected]$H!"%l%7!<%P$,J8;zNs$+$=$N%5%V%/%i%9$N%$%s%9%?%s%9e(B
|e$B8BDj$K$J$k$N$Ge(B #to_str e$B$r;}$C$?J8;zNs$b$I$-$O%@%a$H$$$&$3$H$Ke(B
|e$B$J$j$^$9$M!#e(Bx.to_str + s [email protected]$J$/$Fe(B “#{x}s” e$B$H$7$?$j$b$9$k$N$G!"e(B
|s e$B$,EBMM$J46$8$,$9$ke(B x.to_str >> s e$B$O7y$+$b!J>P!K!#e(B

APIe$B%G%6%$%J$N4uK>$H$7$F$Oe(B to_str e$B$r;}$D%%V%8%’%/%H$O!"e(B
e$B%]%j%b%k%U%#%:%`E
$Ke(BStringe$B$NB>$N%a%=%C%I$b;}$C$F$$$F$[$7$$$Ne(B
e$B$G!"!Ve(Bto_stre$B$O$"$k$,e(B >>
e$B$O$J$$!W$H$$$&$3$H$O5/$-$J$$$h$&$K%*e(B
e$B%V%8%’%/%[email protected]_7W$7$F$[$7$$$H;W$C$F$$$^$9!#e(B

e$B%A%1%C%He(B #3675 e$B$,99?7$5$l$^$7$?!#e(B (by Shyouhei U.)

e$B%9%F!<%?%9e(B Assignede$B$+$ie(BClosede$B$KJQ99e(B

String#prepend has been accepted as revision r29120.

Other proposals including String#>> are pending.

http://redmine.ruby-lang.org/issues/show/3675

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs