Understanding ColdFusion Functions

All programming languages possess their own set of functions that you use to manipulate and format data.

For example, you use functions to:

Function types

ColdFusion contains over 150 different functions. Because Allaire provides solid reference guides, it's not important to memorize these functions; you only need to know what type of operation you want to perform on data.

The table below describes ColdFusion functions by the type of operation that you can apply to data.

ColdFusion Function types Usage example
Display and Formatting
  • Control the display of dates, times, and numbers.
  • For example, use the DollarFormat( ) function to format a salary value retrieved from a database.
Date and Time
  • Perform date-and-time actions.
  • For example, retrieve and display the today's date from the system using the Now( ) function.
Mathematical
  • Perform mathematical operations on values.
  • For example, use the Round( ) function to round a value to the nearest whole number.
String
  • Parse text values and lists.
  • For example, use Find( ) and Replace( ) to find and replace characters in a string.
Decision
  • Use these functions to test for arrays, queries, and their simple values so that you can perform conditional processing.
International
  • Use this set of functions to perform date, time, and currency formatting.
Array
  • Use this set of functions to create, edit, and manage ColdFusion arrays.
Structure
  • Use this set of functions to create, edit, and manage ColdFusion structures.
System
  • Perform actions on directories and paths.
  • For example, use the GetTemplatePath function to get the current page's directory path so that you may use all or a portion of its value on the page.
Other
  • Perform miscellaneous actions on directories, paths and files.
  • For example, use the CreateUUID function to create a unique string that you will use as a persistent identifier in a distributed environment.

During this chapter, you will practice applying display and formatting functions so that you can gain familiarity with general syntax. Refer to the CFML Language Reference for ColdFusion Express for a list of functions and their syntax.