From: Pete Higgins Date: 2012-01-21T07:52:58+09:00 Subject: Re: RCR String#{last, first} --20cf3079ba5623762a04b6fd8a8f Content-Type: text/plain; charset=ISO-8859-1 On Fri, Jan 20, 2012 at 8:47 AM, Roger Pack 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 --20cf3079ba5623762a04b6fd8a8f--