Tinderbox v10 Icon

String.find(matchStr)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator in Current Baseline: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Data manipulation  [other Data manipulation operators]

 v6.5.0

 Baseline

 As at baseline


String.find(matchStr)

This operator returns a Number with the location of the first occurrence of a literal (not regex) substring matchStr within the source string. Thus, the operator searches for literal strings, not regular expressions. Matches are case sensitive. The offset is zero-based (position 1 is zero). If the string is not found, String.find(matchStr) returns -1.

For example, if $MyString is "I do not like green eggs and ham":

$MyNumber = $MyString.find("not"); returns 5

$MyNumber = $MyString.find("blue"); returns -1 (not found in match string)

$MyNumber = $MyString.find("Not"); returns -1 (not found, due to case-sensitive matching)