I think regexp should be is faster than each_byte. What about this? class String def whitespace_only? str str.split(/\n/).each { |x| return false unless x =~ /^\s*$/ } true end end MiG