General Function Rules

No matter what purpose they serve, all ColdFusion's functions share a few common traits.

Function Input

All ColdFusion functions accept either a string or a variable as input. That means you can either supply a specific value you want to format (rare) or use a valid variable name to format (common).

For example, this code

<CFOUTPUT>
#DollarFormat(123456)#
</CFOUTPUT>

produces the same output as the following code:

<CFSET number="123456">

<CFOUTPUT>
#DollarFormat(number)#
</CFOUTPUT>

However, it's more likely that I would use a variable such as #number# from the results of a <CFQUERY> instead of manually defining it with <CFSET>.

Case-Insensitive Function Names

Function names can be specified in any combination of uppercase ...

Get Sams Teach Yourself ColdFusion® in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.