Revision: 22502
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 13, 2010 14:11 by boondoklife
Initial Code
function nl2br(){ var text = escape(this); var re_nlchar = null; if(text.indexOf('%0D%0A') > -1) { re_nlchar = /%0D%0A/g ; } else if(text.indexOf('%0A') > -1) { re_nlchar = /%0A/g ; } else if(text.indexOf('%0D') > -1) { re_nlchar = /%0D/g ; } text = (re_nlchar != null) ? unescape(text.replace(re_nlchar,'<br />')) : unescape(text); return text } String.prototype.nl2br = nl2br;
Initial URL
Initial Description
This will need to be either embeded or included and you can then just use this as such myNewString = myStringVariable.nl2br();
Initial Title
Replace Newlines with BR, String Prototype
Initial Tags
replace
Initial Language
JavaScript