ArrayToList |
Description
Converts a one-dimensional array to a list.
Returns
Delimited list, as a string.
Category
Array functions, Conversion functions, List functions
Function syntax

    ArrayToList(array [, delimiter ])

Parameters

Parameter | Description
array | Name of array
delimiter | Character or multi-character string to separate list elements. Default: comma.

Example

    <h3>ArrayToList Example</h3>
    <cfquery name = "GetEmployeeNames" datasource = "cfsnippets">
    SELECT FirstName, LastName FROM Employees
    </cfquery>
    <!--- create an array --->
    <cfset myArray = ArrayNew(1)>
    <!--- loop through query, append names successively to last element --->
    <cfloop query = "GetEmployeeNames">
       <cfset temp = ArrayAppend(myArray, "#FirstName# #LastName#")>
    </cfloop>
    <!--- show the resulting array as a list --->
    <cfset myList = ArrayToList(myArray, ",")>
    <!--- sort that array descending alphabetically --->
    <cfset myAlphaArray = ArraySort(myArray, "textnocase", "desc")>
    <!--- show the resulting alphabetized array as a list --->
    <cfset myAlphaList = ArrayToList(myArray, ",")>
    <!--- output the array as a list --->
    <cfoutput>
       <p>The contents of the array are as follows:
       <p>#myList#
       <p>This array, alphabetized by first name (descending):
       <p>#myAlphaList#
       <p>This array has #ArrayLen(MyArray)# elements.
    </cfoutput>

array |
Name of array

delimiter |
Character or multi-character string to separate list elements. Default: comma.