From: Ricky Ng Date: 2012-12-21T03:19:43+09:00 Subject: Re: Subtracting strings --14dae93a156d54680504d14cc63f Content-Type: text/plain; charset=ISO-8859-1 a = "hello world" b = "hello " a.sub!(b, "") Is what I usually end up using. Hopefully I get corrected with a cleaner way. On Thu, Dec 20, 2012 at 10:11 AM, John Sampson wrote: > Is there a method for deleting a string identified in a variable from > another string, e.g. > > > myunwantedword = "Hello" > myphrase = "Hello world" > output = myphrase.suchamethod(**myunwantedword) > > > output is now " world" > > Regards > > _John Sampson_ > > > -- Incoherently, Ricky Ng --14dae93a156d54680504d14cc63f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable a =3D "hello world"
b =3D "hello "
a.sub!(b, &qu= ot;")

Is what I usually end up using. Hopeful= ly I get corrected with a cleaner way.=A0
<= br>
On Thu, Dec 20, 2012 at 10:11 AM, John Sampson <= span dir=3D"ltr"><jrs.idx@ntlworld.com> wrote:
Is there a method for deleting a string identified in a variable from anoth= er string, e.g.

<rubycode>
myunwantedword =3D "Hello"
myphrase =3D "Hello world"
output =3D myphrase.suchamethod(myunwantedword)
</rubycode>

output is now " world"

Regards

_John Sampson_





-- Incoherently,
Ricky Ng
--14dae93a156d54680504d14cc63f--