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.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy