ListLen

Calculates the length of a list separated by the specified delimiter

Method Signature

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

Arguments

Argument
Type
Required
Description
Default

list

string

true

string list to calculate the length

delimiter

string

false

string the list delimiter

,

includeEmptyFields

boolean

false

boolean whether to include empty fields in the returned result

false

Examples

Simple listLen Example

Get the number of elements in this list

Run Example

listLen( "foo,bar,bar2,foo2" );

Result: 4

listLen Example with Delimiter

Get the number of elements in this list using a custom delimiter

Run Example

listLen( "foo,bar|bar2|foo2", "|" );

Result: 3

listLen Example with IncludeEmptyValues

Get the number of elements in this list, including empty values

Run Example

listLen( "foo,bar,,foo2", ",", "YES" );

Result: 4

Additional Examples

Run Example

writeDump( listLen( "susi,sam,LAS,test" ) ); // 4
writeDump( listLen( "susi,,LAS,," ) ); // with empty values
writeDump( listLen( "susi,,LAS,,." ) );
 // 3

Last updated

Was this helpful?