Split long strings without breaking word
<p>I have to display multiple long strings (with different length), but I can only display chunks of strings that need them to be between 275 and 295 characters.</p>

<p>So if I have a 3000 words string, It'd be displayed in about 10 pieces.</p>

<p>I'm looking for a way to find the next blank.
For example: </p>

<pre><code>if str[275] != " "
  # find next blank
  p str[0..next_blank]
else
  p str[0..275]
end
</code></pre>

<p>I thought of finding the index of the next blank in the 275-295th characters range, but I couldn't find how to do it in Ruby.</p>

<p>Any help will be much appreciated ! </p>