This version is out of date, covering development from v9.5.0 to v9.7.3. 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(literalStr)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Function  [other Function type actions]

 List  [operators of similar scope]

 Data manipulation  [other Data manipulation operators]

 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().