Skip to content

Instantly share code, notes, and snippets.

@joshcutler
Created August 30, 2010 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcutler/556994 to your computer and use it in GitHub Desktop.
Save joshcutler/556994 to your computer and use it in GitHub Desktop.
Ruby snippet to simulate nl2br
def nl2br(string)
if string
string.gsub("\n\r","<br />").gsub("\r", "").gsub("\n", "<br />")
end
end
@joshcutler
Copy link
Author

Ruby snippet to simulate nl2br

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment