From: "Jesús Gabriel y Galán" Date: 2009-02-01T05:01:47+09:00 Subject: Re: ruby string question On Sat, Jan 31, 2009 at 7:40 PM, Tsunami Scripter wrote: > Is it possible to modify an existing ruby string without creating a new > one ? > > If for example I have the following code : > > x = "first string" > x = "second string" > > between asigning values , the object_id() is different . Is there a > possibility to modify the first string so that after the modifications > the object_id will be the same ? >> a = "first string" => "first string" >> a.replace "second string" => "second string" >> a => "second string" >> a.object_id => 340702860 >> a.replace "third string" => "third string" >> a.object_id => 340702860 > I would like to know how I could get to an empty string from "first > string". I would like to know if a clear method exists,or something > alike. I'm using ruby 1.8.7 . a.replace "" Jesus.