/ Published in: Ruby
![](/img/icon_sav.png?v3)
Hat tip: Allan Odgaard
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def wrap_text(txt, col = 80) txt.gsub(/(.{1,#{col}})( +|$)\n?|(.{#{col}})/, "\\1\\3\n") end
URL: http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
Comments
![RSS Feed for Comments RSS Icon](/images/rss.png?v3)