Operator Type:
Operator Scope of Action:
Operator Purpose:
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]
v9.1.0
Baseline
As at baseline
List/Set.countOccurrencesOf(literalStr)
This function returns the Number of times that the literal string literalStr appears in the source List or Set. For lists, such as List and set types, string of the attribute's raw concatenated list (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/Set.contains() or List/Set.icontains().