Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created May 9, 2021 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennadel/d2e3d344304ae7fe358334006dd84c40 to your computer and use it in GitHub Desktop.
Save bennadel/d2e3d344304ae7fe358334006dd84c40 to your computer and use it in GitHub Desktop.
CFSaveContent Trim And Append Attributes In Lucee CFML 5.3.7.47
<!---
In Lucee CFML, the CFSaveContent tag offers two additional attributes:
* trim - removes leading / trailing whitespace.
* append - adds the content to an existing variable.
--->
<cfsavecontent variable="data" trim="true">
Roses are red,
</cfsavecontent>
<cfsavecontent variable="data" trim="true" append="true">
Violets are blue,
</cfsavecontent>
<cfsavecontent variable="data" trim="true" append="true">
Lucee is insanely powerful,
</cfsavecontent>
<cfsavecontent variable="data" trim="true" append="true">
Deal with it!
</cfsavecontent>
<cfset comma = "," />
<cfset commaWithLinebreak = ",#chr( 10 )#" />
<cfoutput>
<pre>#data.replace( comma, commaWithLinebreak, "all" )#</pre>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment