7stud -- wrote:
>> I'm actually hoping this is an embarrassing question but how do you get
>> the tail end of a string?  All I've figured out is this:
>> 
>> index = 4
>> string[index, string.size - index]
>> 
>>     ...but surely there's a better way.  This happens to me a lot and I
>> really appreciate Python's curt syntax in this case:  string[index:]
>>     What's the Ruby way?
>> 
>>   Thank you!
> 
> str = "hello"
> result = str[1..-1]
> 
> p result
> --output:--
> "ello"

...which is very similar to python--except python doesn't include the 
last index position in the slice:

str = "hello"
result = str[1:-1]
print result

--output:--
ell
-- 
Posted via http://www.ruby-forum.com/.