Tinderbox v9 Icon


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 List   [operators of similar scope]

 Data manipulation   [other Data manipulation operators]




This function returns the Number of times that the literal 'string' 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 If MySet contains "cat;cut;hat;hit;hut;pat;sat", then

$MyNumber = $MySet.countOccurrencesOf("at"); returns 4

string is literal and must not be a regular expression. If the latter is needed use List/Set.contains() or List/Set.icontains().

A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : List/Set.countOccurrencesOf("string")