listPrepend

Inserts an element at the beginning of a list.

listPrepend(someList, value [, delimiters]) → returns string

Member Function Syntax

someList.listPrepend( value [, delimeters])

listPrepend Argument Reference

list string
Required

A string list.

value string
Required

An element or list of elements.

delimiters string
Default: ,

Characters that separate list elements.

Examples sample code invoking the listPrepend function

someList = "1-2-3-4";
someList = listPrepend(someList,"0","-");
writeOutput(someList);

Expected Result: "0-1-2-3-4"

CF 11+ Lucee 4.5+

seinfeldList = "Close Talker,Soup Nazi";
seinfeldList = seinfeldList.listPrepend("Puffy Shirt");
writeOutput(seinfeldList);

Expected Result: "Puffy Shirt,Close Talker,Soup Nazi"


Fork me on GitHub