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.

Leave a Reply