-- Lingo syntax stringExpression1 contains stringExpression2 // JavaScript syntax stringExpression1.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;
}
}