From: Gavin Sinclair Date: 2003-11-15T10:18:08+09:00 Subject: Re: substring: to the end of the string On Saturday, November 15, 2003, 2:48:53 AM, KONTRA wrote: > Hi! > Is there any easiest way to get the substring starting from the 3rd > character? > my solution: > str[3..-1] which seems quite odd :-/ Seems quite even to me :) Seriously, the ability to negative-index strings and arrays like that is a breath of fresh air compared to traditional compiled languages. I see no need to improve on it. > What if, intuitive, we can write > str[3..]? I rather doubt that's going to happen. When you execute str[3..7], the 3..7 isn'y arbitrary syntax, it's a Range object. If Range objects were allowed to be unbounded, then fine. So the question really becomes, should Range objects allow unbounded ranges? > Any smarter solution? Write a String#substring method if you like. Cheers, Gavin