From: Bertram Scharpf Date: 2007-06-15T23:38:08+09:00 Subject: Re: lose the first character Hi, Am Freitag, 15. Jun 2007, 23:24:29 +0900 schrieb John Joyce: > On Jun 14, 2007, at 9:48 PM, Joel VanderWerf wrote: > >Daniel DeLorme wrote: > >>Colin Summers wrote: > >>> r = r.reverse.chop.reverse # remove the first character > >>> > > We could def a method that takes a string and does all of this. One > version could return a new string, the other could trim it in place. > > def nibble(string) > range_end = string.length - 1 > string.slice(1..range_end) > end Obey at least some conventions. class String def shift slice! 0, 1 if any? end alias lchop shift end Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de