htmlCodeFormat

Replaces special characters in a string with their HTML-escaped equivalents and inserts <pre> and </pre> tags at the beginning and end of the string.
The only difference between this function and HTMLEditFormat is that HTMLEditFormat doesn't surround the text in HTML pre tags.

htmlCodeFormat(string [, version]) → returns string

Argument Reference

string string
Required

A String or variable that contains one.

version numeric
Default: 2.0

HTML version to use. Currently ignored.
-1: The latest implementation of HTML
2.0: HTML 2.0 (Default)
3.2: HTML 3.2
Values:
  • -1
  • 2
  • 3.2

Examples
Sample code invoking the htmlCodeFormat function

<cfset testString="This is a test & this is another <This text is in angle brackets> Previous line was blank!!!">   <cfoutput>#htmlCodeFormat(testString)#</cfoutput>   

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub