I ranted about this very behavior 2 days ago. I'm willing to do an RCR if anyone agrees (hint, hint). http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/133894 On Sun, 20 Mar 2005 01:56:40 +0900, David A. Black <dblack / wobblini.net> wrote: > Hi -- > > On Sun, 20 Mar 2005, Jason Sweat wrote: > > > On Sun, 20 Mar 2005 01:07:15 +0900, Glenn Parker > > <glenn.parker / comcast.net> wrote: > >> Aquila wrote: > >>> Possibly a stupid question: why does strip! of a string with a single > >>> character in it give nil and strip the single character? > >>> I don't understand the behaviour of strip!... > >> > >> Looks like a bug to me. > >> > >> $ ruby -e 'p " x ".strip!' > >> "x" > >> > >> $ ruby -e 'p "x".strip!' > >> nil > > > > This came up on another thread recenly. It is a legacy behavior of the > > *! functions that they return nil if nothing changed. > > I don't think it's legacy in the sense that that usually implies > (something that's left over from an older design). That's just the > way they behave. > > David > > -- > David A. Black > dblack / wobblini.net > >