Description

Counts instances of a specified value in a list. The search is case sensitive.

Returns

The number of instances of value in the list.

Category

List functionsString functions

Function syntax

ListValueCount(list, value [, delimiters ])

See also

ListValueCountNoCaseLists in Data types- Developing guide in the Developing ColdFusion Applications

Parameters

Parameter

Description

list

A list or a variable that contains one.

value

String or number, or a variable that contains one. Item for which to search. The search is case sensitive.

delimiters

A string or a variable that contains one. Characters that separate list elements. The default value is comma. If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter.

Example

<cfscript>
    myString="Foo|bar|foo,bar|lorem|ipsum|foo|foo"
    writeOutput("The count of foo is: " & ListValueCount(myString,"foo","|"))
</cfscript>

Output

The count of foo is: 2

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy