ParagraphFormat

Description

Replaces characters in a string:

  • Single newline characters (CR/LF sequences) with spaces
  • Double newline characters with HTML paragraph tags (<p>)

Returns

A copy of the string, with characters converted.

Category

Display and formatting functionsString functions

Function syntax

ParagraphFormat(string)

See also

StripCR

Parameters

Parameter

Description

string

A string or a variable that contains one

Usage

This function is useful for displaying data entered in textarea fields.

Example

<cfscript>
 myText="This is my block of text.
It has both single newline characters in it like this paragraph, and
double newline characters like in the next paragraph.

This is the paragraph with the double newline characters."
writeOutput(ParagraphFormat(myText))
</cfscript>

Output

This is my block of text. It has both single newline characters in it like this paragraph, and double newline characters like in the next paragraph.

This is the paragraph with the double newline characters.

 Adobe

Get help faster and easier

New user?