ListValueCount

returns a count of the number of occurrences of a value in a list

Method Signature

ListValueCount(list=[string], value=[string], delimiter=[string], includeEmptyFields=[boolean])

Arguments

Argument
Type
Required
Description
Default

list

string

true

The list to be searched.

value

string

true

The value to locale

delimiter

string

false

The list delimiter(s)

,

includeEmptyFields

boolean

false

Whether to include empty fields in the search

false

Examples

Simple Example

Counts instances of 'foo' in the list, ignoring case

Run Example

listValueCountNoCase( "foo,bar,lorem,Foo,ipsum", "foo" );

Result: 2

Example with Custom Delimiter

Counts instances of 'foo' in the list with a custom delimiter, ignoring case

Run Example

listValueCountNoCase( "bar|Foo|lorem,ipsum|me|foo,something|foo|FOO", "foo", "|" );

Result: 3

Additional Examples

Run Example

List = "boxlang,ACF,boxlangExt,boxlang, ext,BOXLANGEXT";
writeDump( ListValueCount( list, "boxlang" ) ); // It return's 2
writeDump( ListValueCount( list, "boxlangExt" ) ); // It return's 2 because it case Insensitive
List2 = "boxlang@ACF@boxlangExt@boxlang@ext@BOXLANGEXT";
writeDump( ListValueCount( list2, "boxlang", "@" ) );

Last updated

Was this helpful?