Description

Converts a one-dimensional array to a list.

Returns

Delimited list, as a string.

Category

Array functionsConversion functionsList functions

Function syntax

ArrayToList(array [, delimiter ])

Parameters

Parameter

Description

array

Name of array

delimiter

Character or multicharacter string to separate list elements. The default value is comma.

Example

<cfscript>
       // Declare an array
       myArray=ArrayNew(1);
       myArray=["Google","Microsoft","Adobe","Facebook","Amazon"];
       myList=ArrayToList(myArray);
       WriteOutput(myList);
</cfscript>

Output

Google,Microsoft,Adobe,Facebook,Amazon

Example using member function

<cfscript>
       // Declare an array
       myArray=ArrayNew(1);
       myArray=["Google","Microsoft","Adobe","Facebook","Amazon"];
       myConvertedList=myArray.toList();
       WriteOutput(myConvertedList);
</cfscript>

Output

Google,Microsoft,Adobe,Facebook,Amazon

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy