listNew

Creates a new list. With no arguments it returns an empty list; with a value it returns that value as a single-item list. The optional delimiters argument sets the list's delimiters. In RustCFML lists are plain delimited strings, so this is a convenience constructor over the string type.

listNew([value] [, delimiters]) → returns string

This function requires RustCFML.  Not supported on Lucee, Adobe ColdFusion, etc.

Argument Reference

value string

Optional initial list content.

delimiters string
Default: ,

Optional delimiter string for the list.

Examples
Sample code invoking the listNew function

Create an empty list.

l = listNew();
writeDump(listLen(l));

Expected Result: 0

Wrap a value in a new list.

l = listNew("one");
writeDump(listFirst(l));

Expected Result: one

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

Fork me on GitHub