From: Joao Pedrosa Date: 2004-10-11T23:22:58+09:00 Subject: Re: string replacement Hi, On Mon, 11 Oct 2004 23:06:58 +0900, J.Lang wrote: > we need to replace a whitespace with a
if the string is longer > then 30 chars (next whitespace after 30 chars) > > does someone have a idea to programm this in ruby? Maybe: 5.times{ s = ' ' * (rand * 50) len = s.size z = s[30..-1] if z s = s[0..29] + z.gsub(' ', '
') end p "s (#{len}): #{s}", '---', "z: #{z}", '---' } Cheers, Joao