arrayToList

Converts a one-dimensional array to a list.

arrayToList(array [, delimiter]) → returns String

Member Function Syntax

someArray.toList([delimiter])

Argument Reference for the arrayToList function

array

Required: Yes

delimiter

Required: No
Default: ,
Values:
  • ,
  • |
  • _
  • ;
  • :

Examples sample code invoking the arrayToList function


Retrieve an array as a list

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

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

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


Retrieve an array as a list using the Array member function

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"


Fork me on GitHub