Removing Newlines

Ken Dickinson's Avatar

Ken Dickinson

04 Jan, 2013 04:41 PM

What is the best way to remove newlines from a variable. For example, I have a node containing xhtml. TinyMCE will automatically add newlines to the value. I've tried various replace functions but I still get the new line (what I want is to put the html code from TinyMCE into an ASP.NET variable). replace('\n', ' ') works strangely. In this example, it will add the space, but the newline remains.

  1. 1 Posted by Eric L. Epps on 04 Jan, 2013 06:06 PM

    Eric L. Epps's Avatar

    Perhaps it's using Windows-style newlines? (\r\n)

  2. 2 Posted by Ken Dickinson on 04 Jan, 2013 07:58 PM

    Ken Dickinson's Avatar

    That was indeed the solution. Thank you!

  3. Tim closed this discussion on 04 Jan, 2013 08:26 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac