On 2007-01-07 01:21:54 +0100, "Claus Guttesen" <kometen / gmail.com> 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"