A list is one of the most basic variable types in ColdFusionalthough, in truth, a list is not a type per se. A list is a simple set of data separated by one or more delimiters. The following is a simple list of six American states (in this example, the list is delimited by commas): CA,FL,MA,MI,NY,WA The individual items in a list are known as elements, and unless a list is an empty string, it always contains at least one element. By default, lists are delimited by commas, but ColdFusion allows you to specify any character (or multiple characters) as the delimiter. The following is the same list, this time delimited by spaces: CA FL MA MI NY WA In fact, any variable that is not a complex type (like an array or a structure) is a list, regardless of whether you use it that way. Unlike an array or a structure, a list is not actually a data type. Rather, it is nothing more than a simple string, and ColdFusion treats it as such internally. When you access a specific element in a list (we'll get to that topic in a moment), ColdFusion performs basic string processing for you because that's all lists arestrings.
Arrays and structures are covered in detail in Chapter 14, "Arrays," and Chapter 15, "Structures." NOTE ColdFusion stores arrays and structures in memory in special formats designed specially for structured data. This makes accessing and manipulating arrays and structures far quicker than accessing and manipulating lists that are simply strings. List processing is essentially the processing of strings and substrings. |