daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Jan 12th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Break up a string with \n every 30 chars [closed]
  2. if @square.text.length > 30
  3.   text = @square.text[0, 31] + "n" + @square.text[31, @square.text.length]
  4. else
  5.    text = @square.text
  6. end
  7.    
  8. include ActionView::Helpers::TextHelper
  9. # or, if you are in a controller
  10. # helper :text
  11.  
  12. word_wrap(@square.text, :line_width => 30)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand