Convert new lines to single line space when read from external file

This is a handy code that I use very often in actionscript 1 and 2 to convert new lines to one new line as it is visible in html. Flash thinks them as double new lines \n\n instead of \r\n (return and new line). This code removes \n (new line) and leaves \r (return) in string.

function textToFlashTF(text) {
return text.split('\r\n').join('\r');

  • Start your Classifieds website Today!

    Build online community using our responsive classifieds script

    Learn more

Leave a Reply

Your email address will not be published. Required fields are marked *