From: Leonard Chin Date: 2007-06-01T21:02:59+09:00 Subject: Re: Getting the last N bytes of a string: buf.reverse[0,10]? On 6/1/07, Brian Candler wrote: > What's the simplest way to get only the last 10 bytes of a string? > > buf[-10,10] > > doesn't work if buf is smaller than 10 bytes, as it returns nil. Is there > anything simpler than > > buf[-10,10] || buf > > ? > > Thanks, > > Brian. > > P.S. To get the *first* 10 bytes of a string is easy: buf[0,10] always > works, whether or not buf is smaller than 10 bytes) > >