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

a string list

value
string, required

a string value

delimiters
string, optional

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

if false it cleans up empty fields.

Introduced: 5.3.5.17

true

Examples

Example 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