From: Chris Causer Date: 2008-10-22T07:38:17+09:00 Subject: Re: Stripping characters off a string ------=_Part_17294_18530726.1224628782462 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, Oct 21, 2008 at 11:22 PM, Sebastian Hungerecker < sepp2k@googlemail.com> wrote: > Chris Causer wrote: > > > your_string = "abcdef" # => "abcdef" > > > your_string[-4,4] = '' # => "" > > > your_string # => "ab" > > > > Does that really work > > Yes, it does. If you copy and paste that code into irb, you'll see the > exact > output you see above (minus the # plus newlines plus the irb prompt) > Ah, now I see. I missed the ='' on the second line. Thanks Marc and Sebastian, but the range method is particularly alluring :) ------=_Part_17294_18530726.1224628782462--