Functions are a form of operator. Because ColdFusion functions return basic objects, such as numbers, strings, Boolean values, date-and-time objects, lists, arrays, structures, queries, and COM objects, function results can be used as operands.
The following sections describe:
The following table shows function syntax and usage guidelines.
For more information on how to insert functions in expressions, see "Pound Signs".
Functions can take optional arguments after their required arguments. If omitted, all optional arguments default to a predefined value. For example:
Replace("FooFoo", "Foo", "Boo") returns "BooFoo"
Replace("FooFoo", "Foo", "Boo", "ALL") returns "BooBoo"
The difference in the results is because the Replace
function takes an optional fourth argument that specifies the scope of replacement. The default value is "ONE" which explains why only the first occurrence of "Foo" was replaced with "Boo". In the second example, a fourth argument causes the function to replace all occurrences of "Foo" with "Boo".