On 7/24/07, LeonB <leon / tim-online.nl> wrote:
> I created this function:
>
> class String
>         def rtrim(character)
>
>                 if self[-1, 1] == character.to_s
>                         self[0, self.length - 1]
>                 end
>                 return self
>         end
>
>         def ltrim(character)
>                 if self[0, 1] == character.to_s
>                         self[1, self.length]
>                 end
>                 return self
>         end
> end

I'm not sure this does what you want it to.  The object referenced by
self has not changed because the [] method does not alter the String.

Todd