contains()

Example 1:

A case sensitive comparison:

var fullName = "Ms Jane Doe"
var firstName = String.contains(fullName, "Jane")

Note:

In this example, firstName is true because the term ‘Jane’ is contained within the variable name. If the term ‘jane’ had been used, firstName would be false.

Example 2:

A case insensitive comparison:

if ( String.contains("This is a Test", "test", true) )
{
Debug.trace("Found");
}
else
{
Debug.trace("Not found");
}

Note:
In this example, "Found" is displayed in the script output window because the IgnoreCase flag is set to true and the term ‘test’ is contained within the string. If the IgnoreCase flag was set to false, "Not found" would be displayed.