User Guide

688 Chapter 3: ColdFusion Functions
StripCR
Description
Deletes return characters from a string.
Returns
A copy of string, after removing return characters.
Category
Display and formatting functions, Other functions, String functions
Function syntax
StripCR(string)
See also
ParagraphFormat
Parameters
Usage
Useful for preformatted (between <pre> and </pre> tags) HTML display of data entered in
textarea fields.
Example
<h3>StripCR Example</h3>
<p>Function StripCR is useful for preformatted HTML display of data
(PRE) entered in textarea fields.
<cfif isdefined("Form.myTextArea")>
<pre>
<cfoutput>#StripCR(Form.myTextArea)#</cfoutput>
</pre>
</cfif>
<!--- use #Chr(10)##Chr(13)# to simulate line feed/carriage return combination
--->
<form action = "stripcr.cfm">
<textarea name = "MyTextArea" cols = "35" rows = 8>
This is sample text and you see how it scrolls
<cfoutput>#Chr(10)##Chr(13)#</cfoutput>
From one line
<cfoutput>#Chr(10)##Chr(13)##Chr(10)##Chr(13)#</cfoutput>
to the next
</textarea>
<input type = "Submit" name = "Show me the HTML version">
</form>
Parameter Description
string A string or a variable that contains one