ListAppend()
Concatenates a list or element to a list.
ListAppend( list=string, value=string, delimiters=string, includeEmptyFields=boolean );
Returns: String
| Argument | Description | Default |
|---|---|---|
|
list
string,
required
|
edit
a string list |
|
|
value
string,
required
|
edit
a string value |
|
|
delimiters
string,
optional
|
edit
Characters that separate list elements. The default value is comma. If this string contains more than one character, only the first character is used. Alias: delimiter |
, |
|
includeEmptyFields
boolean,
optional
|
edit
if false it cleans up empty fields. Introduced: 5.3.5.17 |
true |
Examples
editExample without delimiter argument:
mylist = "one,two,three";
mynewlist = listAppend(mylist, "four");
// Note that listAppend creates a new list. It doesn't update the existing list:
writeDump(mylist);
writeDump(mynewlist);
Expected result: one,two,three,four
Example with delimiter argument:
mylist = "foo";
mynewlist = listAppend(mylist, "bar", "|");
writeDump(mynewlist);
Expected result: foo|bar
See also
- Lists
- Strings
- string.listAppend()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)