ListCompact

Compacts a list by removing empty items from the start and end of the list

Method Signature

ListCompact(list=[string], delimiter=[string], multiCharacterDelimiter=[boolean])

Arguments

Argument
Type
Required
Description
Default

list

string

true

The list to compact

delimiter

string

false

string the list delimiter

,

multiCharacterDelimiter

boolean

false

boolean whether the delimiter is multi-character

false

Examples

Trims first and last comma from list string

Run Example

listCompact( ",eggs,milk,bread,flour," );

Result: eggs,milk,bread,flour

Additional Examples

Run Example

// Simple function
writeOutput( listCompact( ",,,Plant,green,save,earth,," ) );
// Member function with custom delimiter
strLst = "+++1+2+3+4+++++++";
writeDump( strLst.listCompact( "+" ) );

Last updated

Was this helpful?