From: Andreas Schwarz Date: 2003-08-23T06:38:52+09:00 Subject: Re: Line wrapping Andreas Schwarz wrote: > It doesn't work correctly, I have to think about it again... OK, now this finally seems to work: def wrap(a, max_len) s = a.gsub(/.{0,#{max_len}}(?:\s|\Z)/){($& + 5.chr).gsub(/\n\005/,"\n")} while(s.sub!(/((\n|^)[>|\s]*[>|].*?)\005/, "\\1")) do end return s.gsub(/\005/,"\n") end I don't think it is a very good solution, so if someone comes up with a better one I would really like to see it. Andreas -- AVR-Tutorial, �ber 350 Links Forum f�r AVRGCC und MSPGCC -> http://www.mikrocontroller.net