ColdFusion – replace nl to br

Just a quickie if you need to replace NL (New Line or Carriage Return) in CFMX;

<cfset text = replace(text,'#Chr(10)##Chr(13)#','<br>',"All")>

You could also wrap it up in a CFC or a function if it’s going to be widely used.

Bookmark and Share
This entry was posted in All The Rest and tagged , , . Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">