From: Chris Gernon Date: 2006-12-29T02:04:02+09:00 Subject: Re: Strip is not stripping trailing whitespace Charles A Gray wrote: > line.chop will remove one of the "\240"s. line.chop.chop.chop will > remove all three, but they will still be on line. To completely remove > them, use line.chop!.chop!.chop! where line = the string you wish to > change. line = line.chop.chop.chop would be better. In general, you shouldn't chain destructive methods, because they usually return nil when they fail: irb> line = '' => "" irb> line.chop! => nil irb> line = '' => "" irb(main):004:0> line.chop!chop! TypeError: $_ value need to be String (nil given) from (irb):4:in `chop!' from (irb):4 As opposed to: irb> line = '' => "" irb> line = line.chop.chop.chop => "" -- Posted via http://www.ruby-forum.com/.