From: ChrisH Date: 2007-03-13T03:05:05+09:00 Subject: Re: Efficiency of string parsing Had to take a swipe 9^) class String def wrap(wrap_col) retStr = self.dup start = 0 while retStr[start,wrap_col].length >= wrap_col ws_pos = retStr[start,wrap_col].rindex(" ") break if ws_pos.nil? retStr[ws_pos+start] = "\n" start += ws_pos+1 end retStr end end Cheers Chris