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

Jump to the current version of aTbRef

TinderboxSix Icon

List/Set.icontains("pattern")


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Item   [operators of similar scope]

 Query Boolean   [other Query Boolean operators]

 Baseline

 


List.icontains("pattern")

This operator tests whether pattern matches the target string attribute or matches a whole discrete value string within a the target list/set attribute value. Matches are always case-insensitive, unlike String/List.contains(). The match gives a Boolean result.

pattern is one of:

$MyList.icontains("pattern")

The contains operator may also be used with both sets and lists, in which case it tests for set membership, i.e. matching to complete individual values rather than part of values. Thus:

$MyList.icontains("Tuesday") 

is true if $MyList is "Monday;Tuesday;Friday". Other examples:

$MyList.icontains($MyDay) 

$MyList(parent).contains("Tuesday") 

The left-hand argument may also be a literal list:

"Saturday;Sunday".icontains($MyDay) 

If the regular expression pattern is found the function returns the match offset+1, where offset is the distance from the start of the string to the start of the matched pattern. Formerly, .icontains() returned true if the pattern was found. The '+1' modifier ensures that a match at postion zero return a number higher than zero which would otherwise coerce to false. Since 1+offset is always true, no changes are required in existing documents but the function also now gives usable offset information.

Testing "does not contain"

Use a ! prefix to the query argument:

!$MyList.icontains("Tuesday") 

Use of parentheses after the !, around the query, can assist Tinderbox's parsing:

!($MyList.contains("Tuesday")) 

Dealing with inline quote characters

Because pattern is parsed for regular expressions, it may be possible to use the '\dnn' form described here to work around the lack of escaping from single double quotes within strings.



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