From: LeonB Date: 2007-07-26T04:40:06+09:00 Subject: Re: rtrim and ltrim function for ruby: is this ok? Pfff... Sorry for the second post. I couldn't find the first one on Google groups. I tried changing the self object. But I wasn't allowed to do it. I got an error message when I did that: "Can't change the value of self" So I changed it to: class String def rtrim(character) ret = self if self[-1, 1] == character.to_s ret = self[0, self.length - 1] end return ret end def ltrim(character) if self[0, 1] == character.to_s ret = self[1, self.length] end return ret end end This works. But I would rather see the first object changed. Is this possible?