Inserts an element at the beginning of a list.
listPrepend(someList, value [, delimiters, includeEmptyFields])
returns string
someList.listPrepend( value [, delimiters, includeEmptyFields])
Name | Type | Required | Default | Description | Values | |
---|---|---|---|---|---|---|
list | string | Yes | A string list. | |||
value | string | Yes | An element or list of elements. | |||
delimiters | string | No | , | Characters that separate list elements. | ||
includeEmptyFields | boolean | No | false | CF2018+ Set to true to insert blank values to the beginning of the list. | /Users/garethedwards/development/github/cfdocs/docs/functions/listprepend.md | false |
CF11+ Lucee4.5+
seinfeldList = "Close Talker,Soup Nazi";
seinfeldList = seinfeldList.listPrepend("Puffy Shirt");
writeOutput(seinfeldList);
someList = "1-2-3-4";
someList = listPrepend(someList,"0","-");
writeOutput(someList);
CF2018+
someList = "Feb,Mar,Apr";
someList = listPrepend(someList, ",,Jan", ",", true);
writeOutput(someList);
CF2018+
someList = "Feb,Mar,Apr";
someList = listPrepend(someList, ",,Jan,,", ",", false);
writeOutput(someList);