Counts instances of a specified value in a list.
The search is case-sensitive. For case-insensitive search use listValueCountNoCase.

listValueCount(list, value [, delimiters]) → returns numeric

Argument Reference

list string

value string

delimiters string
Default: ,

Sample code invoking the listValueCount function

Counts instances of 'foo' in the list

listValueCount("foo,bar,lorem,foo,ipsum", "foo")

Expected Result: 2

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

listValueCount("bar|foo|lorem,ipsum|me|foo,something|foo|FOO", "foo", "|")

Expected Result: 2

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub