From: Florian Gross Date: 2007-01-07T09:26:09+09:00 Subject: Re: get remaing characters in a string On 2007-01-07 01:21:54 +0100, "Claus Guttesen" said: > Hi. > > I need to get the last three characters in a string. I couldn't find a > function in the String class so I came up with this: > > Did I reinvent the wheel or does it make sense to add it to String? I'd just do str.slice!(-n .. -1) instead: str = "Hello World" str.slice!(-3 .. -1) # => "rld" str # => "Hello Wo" str.slice!(-1 .. -1) # => "o" str # => "Hello W"