-- Lingo syntaxstringExpression1containsstringExpression2// JavaScript syntaxstringExpression1.indexOf(stringExpression2);
Operator; compares two strings and determines whether stringExpression1 contains stringExpression2 (TRUE) or not (FALSE).
The contains comparison operator has a precedence level of 1.
The contains comparison operator is useful for checking whether the user types a specific character or string of characters. You can also use the contains operator to search one or more fields for specific strings of characters.
This example determines whether a character passed to it is a digit:
-- Lingo syntax
on isNumber aLetter
digits = "1234567890"
if digits contains aLetter then
return TRUE
else
return FALSE
end if
end
// JavaScript syntax
function isNumber(aLetter) {
var digits = "1234567890"
if (digits.indexOf(aLetter) >= 0) {
return true;
} else {
return false;
}
}
Note: The string comparison is not sensitive to case or diacritical marks; "a" and Å are treated the same.
offset() (string function), starts