Remove empty elements from start and end of the list

listCompact(list [, delimiters] [, multiCharacterDelimiter]) → returns string

Member Function Syntax

list.listCompact([delimiters] [, multiCharacterDelimiter])

This function requires Lucee. Not supported on Adobe ColdFusion.

listCompact Argument Reference

list string

delimiters string
Default: ,

multiCharacterDelimiter boolean
Default: false

Examples sample code invoking the listCompact function

Trims first and last comma from list string


Expected Result: eggs,milk,bread,flour

Fork me on GitHub