On Fri, Jan 20, 2012 at 8:47 AM, Roger Pack <rogerpack2005 / gmail.com> wrote:

> Hello.
> I noticed today that it is very easy to get the first few characters of
> a String:
>
> string[0..whatever]
>
> however, it is harder to get the last few characters of a String
>
> string[-8..-1] || string
>
> Feature request/proposal:
> String#last(n)
> like
>
> string.last(8)
>
> Feedback welcome.
> -roger-
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
There's always the two argument form of slice:

> "my string"[-3, 3]
# => "ing"

Not quite as nice as yours, however.

pete