From: John Butler on
Hi,

I have text that is petty large. What i want to do is split it into an
array of no more than 250 characters per line but finishing on a full
word at the end of each line. So if the last word was "ruby" but 'b'
was the 250th character in the line then i want the line to cut off
before ruby and then start at ruby for the next line. What i have at
the minute is below which splits the text into an array of lines 250
characters long, but as i say it slices through words at the end of the
250 character limit.

mytext.scan(/.{1,250}/m)

Any ideas?

JB
--
Posted via http://www.ruby-forum.com/.