From: Robert Klemme Date: 2009-11-02T18:50:11+09:00 Subject: Re: How do you get the tail end of a string? On 2 Nov., 03:16, "Just Another Victim of the Ambient Morality" wrote: > "Michael W. Ryder" <_mwryde...@gmail.com> wrote in messagenews:d3oHm.2522$1R3.528@newsfe18.iad... > > > > > What method doesn't work?  If you mean the string[-index, index] method it > > does work fine for me.  I am using 1.9.1 if that makes any difference. > > The string[-index..-1] method does the same thing but I have used Business > > Basic for over 20 years so my method was easier for me. > >     In retrospect, I'm surprised I put it so harshly but it doesn't do the > same thing as the other method.  Your solution requires that you know how > long a tail you need.  If, instead, you know how much of the head you need > to remove but don't know or care how long the tail is, your method is > insufficient... The you can still do string[len..-1] or string.slice(len..-1) and do not have to repeat the length. I don't really understand what all the fuzz is about. You can get at the information you need and it's not even difficult. It's just not that there is an explicit method which accepts a single parameter for the length which retrieves said portion of the beginning or end. The reason why there is probably not a #left or #right in String is that often string manipulation is done via regular expressions anyway instead of via indexes. Personally I find solutions like s[/\w+\z/] very elegant. Kind regards robert