From: Taylor Strait Date: 2006-12-28T15:29:29+09:00 Subject: Strip is not stripping trailing whitespace I have files with city names which have one or two trailing whitespaces: Adelanto <- Agoura Hills <- Alameda <- Albany <- Alhambra <- Aliso Viejo <- My method just iterates and strips! def trim(state) diskfile = File.new(state + "-cleaned.txt", "w") $stdout = diskfile IO.foreach(state + ".txt") do |line| line.strip! puts line end diskfile.close $stdout = STDOUT end The output successfully removes leading whitespace but not trailing whitespace. What am I doing wrong? I would chop! but the number of trailing whitespace characters varies and my attempt at a while loop to check and chop! was unsuccessful. -- Posted via http://www.ruby-forum.com/.