Operator Type:
Operator Scope of Action:
Operator Purpose:
Data Type Returned:
Operator First Added:
Operator in Current Baseline:
Operator Last Altered:
Function [other Function type actions]
List [operators of similar scope]
Data manipulation [other Data manipulation operators]
Number [about Number data type]
v9.1.0
Baseline
As at baseline
list.countOccurrencesOf(literalStr)
This function returns the Number of times that the literal string literalStr appears in the source List- or Set-type list. A string of the attribute's raw concatenated list values (i.e. with semicolon delimiters) is tested.
If $MyList contains "ant;bee;ant;cow;ant", then:
$MyNumber = $MyList.countOccurrencesOf("ant"); returns 3
Sets de-duplicate, but partial matches of Sets do not. If $MySet contains "cat;cut;hat;hit;hut;pat;sat", then
$MyNumber = $MySet.countOccurrencesOf("at"); returns 4
literalStr is literal and must not be a regular expression. If the latter is needed use list.contains() or list.icontains().