listItemTrim

Trims every item in the list and returns a new list.

listItemTrim(list [, delimiters] [, includeEmptyFields]) → returns string

Member Function Syntax

list.listItemTrim([delimiters] [, includeEmptyFields])

This function requires Lucee.  Not supported on Adobe ColdFusion, etc.

Argument Reference

list string
Required

The list with the items, you want to trim.

delimiters string
Default: ,

The delimiters which the list is using.

includeEmptyFields boolean
Default: false

By default empty items will be removed from the list. If it is true, empty items will be stay in the list.

Examples
Sample code invoking the listItemTrim function

Trims each item in the list.

exampleList = "hello, world ,this, is a, ,example";
writeOutput(listItemTrim(examplelist));

Expected Result: hello,world,this,is a,,example

Trims each item in the list.

exampleList = "hello, world ,this, is a, ,example";
exampleList = exampleList.listItemTrim();
writeOutput(examplelist);

Expected Result: hello,world,this,is a,,example

Trims each item in the list and keep empty items.

exampleList = "hello, world ,this, is a,  ,,example";
writeOutput(listItemTrim(examplelist, ",", true));

Expected Result: hello,world,this,is a,,,example


Fork me on GitHub