This version is out of date, covering development from v9.0.0 to v9.3.0. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

List/Set.countOccurrencesOf("string")


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]

 9.1.0

 


List/Set.countOccurrencesOf("string")

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")