From: LeonB Date: 2007-07-26T04:29:59+09:00 Subject: rtrim and ltrim function for ruby: is this ok? I made these two functions to extend the default String object: 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 Are they ok? I mean, aren't there any default Ruby functions I am copying? I looked on google for functions that did the same as above functions, but I couldn't find any for Ruby. Thanks in advance!