Replacing all consecutive &ldquo;\r\n or \n&rdquo;s with one single <br>

cargo55

New Member
Currently I am showing messages that I get from DB using only these two replacements:\[code\]text = text.replace("\r\n", "<br />");text = text.replace("\n", "<br />");\[/code\]but the problem is if there are many consecutive "\n"s I will have lots of
s or white spaces, I just want to make them all one. So what is your suggestion? Is there a quick replace method to make all consecutive \n\n\n\n\n\n\n only one just one br?
 
Back
Top