Jesús Gabriel y Galán
12/22/2008 8:00:00 AM
On Sat, Dec 20, 2008 at 9:26 PM, Phlip <phlip2005@gmail.com> wrote:
>> irb(main):002:0> s.insert(0, "hello ")
>
> ['hello ', s].join
>
> ...and how about unshift?
>
> Any sicker ways out there?? Besides s = 'hello ' + s?
Just a note: both your join method and the + method above will create
a new string object, while the other methods in this thread (insert,
[/\A/], [0,0]) will modify the string in place. This might or might
not matter to the OP.
Regards,
Jesus.