Right now I basically use this code for word wrapping:
def word_wrap(line_width = 80)
self.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n")
end
Is anyone using a better solution? This method should be
robust enough to do "proper" line wrapping of really
long strings - like strings long enough to fill
a big book.
Right now I basically use this code for word wrapping:
def word_wrap(line_width = 80)
self.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n")
end
Is anyone using a better solution? This method should be
robust enough to do "proper" line wrapping of really
long strings - like strings long enough to fill
a big book.