Skip to content

Instantly share code, notes, and snippets.

@bennadel

bennadel/test.cfm

Created May 9, 2021
Embed
What would you like to do?
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