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 I'd use: buf[-10..-1] || buf but this is only a variation of what you have. There is buf.reverse[0..9].reverse as well, but this looks even uglier to me than the first. Stefan