arrayToList

Converts a one-dimensional array to a list.

arrayToList(array [, delimiter]) → returns string

Member Function Syntax

someArray.toList([delimiter])

Argument Reference

array array
Required

delimiter string
Default: ,

Examples
Sample code invoking the arrayToList function

Uses the arrayToList function with a pipe delimiter to retrieve an array as a list

someArray = [1,2,3,4];
someList = arrayToList(someArray,"|");
writeOutput(someList);

Expected Result: "1|2|3|4"

CF 11+ Lucee 4.5+ Uses the Array member function to retrieve an array as a list

seinfeldArray = ["Jerry","Elaine","Kramer","George"];
seinfeldList = seinfeldArray.toList();
writeOutput(seinfeldList);

Expected Result: "Jerry,Elaine,Kramer,George"

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub