Concatenates a list or element to a list and returns the concatenated list.
listAppend(list, value [, delimiters, includeEmptyFields])
returns string
str.listAppend(value [, delimiters, includeEmptyFields])
Name | Type | Required | Default | Description | Values | |
---|---|---|---|---|---|---|
list | string | Yes | A list or variable with the list. | |||
value | string | Yes | An element or a list of elements. | |||
delimiters | string | No | , | A string or variable with a character that separates list elements. | ||
includeEmptyFields | boolean | No | false | CF2018+ Set to true to append blank values to the list. | /Users/garethedwards/development/github/cfdocs/docs/functions/listappend.md | false |
Add ‘foo’ to the end of this list
oldList = "bar,bar2";
newList = listAppend(oldList, "foo");
writeOutput(oldList & "-->" & newList);
Add ‘foo’ to the end of this list using a custom delimiter
oldList = "bar,bar2";
newList = listAppend(oldList, "foo", "|");
writeOutput(oldList & "-->" & newList);
CF2018+ Add ‘foo,,’ to the end of this list using includeEmptyFields as true
oldList = "bar,bar2";
newList = listAppend(oldList, "foo,,", ",", true);
writeOutput(oldList & "-->" & newList);
CF2018+ Add ‘foo’ to the end of this list using includeEmptyFields as false
oldList = "bar,bar2";
newList = listAppend(oldList, "foo,,", ",", false);
writeOutput(oldList & "-->" & newList);