ListItemTrim

Trims each item in the list.

Method Signature

ListItemTrim(list=[string], delimiter=[string], includeEmptyFields=[boolean])

Arguments

Argument
Type
Required
Description
Default

list

string

true

string list to trim each item

delimiter

string

false

string the list delimiter

,

includeEmptyFields

boolean

false

boolean whether to include empty fields in the returned result

false

Examples

Simple Example

Trims each item in the list.

Run Example

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

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

Using as member function

Trims each item in the list.

Run Example

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

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

Keep empty items in the list

Trims each item in the list and keep empty items.

Run Example

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

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

Additional Examples

Run Example

// Simple Example
writeoutput( listItemTrim( "Susi , LAS  ,,boxlang,,,test,," ) );
// Member Function
strList = ",I,      , love,boxlang  ,,";
writeDump( strList.listItemTrim() );

Last updated

Was this helpful?