"Robert Klemme" <shortcutter / googlemail.com> wrote in message news:2921fe3d-ba17-4cef-8e17-aed40ce9e253 / m16g2000yqc.googlegroups.com... On 2 Nov., 03:16, "Just Another Victim of the Ambient Morality" <ihates... / hotmail.com> 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. What is up with my client that it randomly chooses to not quote?! I'm sorry about this... It's not a big fuss, it's just odd that a language that is filled with all sorts of other nicities doesn't have a simple solution to match a simple and common problem. To give another example, in some sense reversed, we all appreciate how Ruby has anonymous closures (blocks). Python has closures too, they're just not anonymous and they are, thus, rather ugly to use. Practically, this is meaningless since you can simply declare your closure (which is strangely just a function) just in front of where you need it but I'm sure we all look at that and think the same thing: it would be nice if Python had anonymous closures like Ruby! It's just a strange juxtaposition to see Ruby supply arrays with a .last method but not provide strings with a simple way of getting the tail, especially since this is present in competing languages... Finally, I could have sworn that you were the one advocating that using regular expressions for string manipulations that don't specifically require their power to be unnecessarily dangerous! Am I mistaken?