ListToArray

Converts the specified list into an array.

See also ArrayToList.

Syntax

ListToArray(list [, delimiter ])
list

Name of the list variable that contains the elements to be used to build an array. You can define a list variable with a CFSET statement. The items in the list must be separated by commas or otherwise delimited.

delimiter

Specify the character(s) used to delimit elements in the list. Default is comma ( , ).

Example

<!--- This example shows ListToArray --->
<HTML>
<HEAD>
<TITLE>ListToArray Example</TITLE>
</HEAD>

<BODY>
<H3>ListToArray Example</H3>

<!--- Find the deparments in the database --->
<CFQUERY NAME="GetDepartments" DATASOURCE="HRApp">
SELECT Department_Name
FROM Departments
</CFQUERY>

<CFSET myList=ValueList(GetDepartments.Department_Name)>
<P>My list has <CFOUTPUT>#ListLen(myList)#</CFOUTPUT>
  items.
<CFSET myArrayList=ListToArray(myList)>
<P>My array has <CFOUTPUT>#ArrayLen(myArrayList)#
  </CFOUTPUT> elements.

</BODY>
</HTML>