String#slice!

e$BEOJUE/Li$G$9!#e(B

String#slice! e$B$NLaCM$J$N$G$9$,!"$*$+$7$$$h$&$G$9!#e(B

ruby 1.9 trunk 13289

------------------------------ e$B:F8=%3!<%Ie(B
l = “1234\n234\n34\n4\n”

while j = l.slice!(/\A.*\n/)
p j
end

------------------------------ e$B<B9T7k2Le(B
$ ruby -v
ruby 1.9.0 (2007-08-27 patchlevel 0) [i686-linux]
$ ruby j.rb
“1234\n”
“4\n4\n”
“\0004\n”
“4\n”

$ /usr/bin/ruby -v
ruby 1.8.2 (2004-11-03) [i386-linux]
$ /usr/bin/ruby j.rb
“1234\n”
“234\n”
“34\n”
“4\n”

e$B:F8=%9%/%j%W%H$Ne(B


l = “1234\n234\n34\n4\n”

e$B$re(B


l = “123\n23\n3\n”

e$B$K$9$k$H8=>]$O5/$-$J$$$h$&$G$9!#e(B

e$BCfED$5$s$Xe(B

e$BEOJUE/Li$G$9!#e(B

[email protected]$G8=>]$,<#$^$C$?$3$H$r3NG’$7$^$7$?!#e(B
e$BBP1~$"$j$,$H$&$4$6$$$^$9!#e(B

In message “[ruby-dev:31665] String#slice!”
on 07/08/28, WATANABE Tetsuya e$B$5$se(B writes:

|String#slice! e$B$NLaCM$J$N$G$9$,!"$*$+$7$$$h$&$G$9!#e(B

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