User Guide
612 Chapter 13: Operators
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.
Example
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.
See also
offset() (string function), starts
mod
Usage
-- Lingo syntax
integerExpression1 mod integerExpression2
// JavaScript syntax
integerExpression1 % integerExpression2
Description
Math operator; performs the arithmetic modulus operation on two integer expressions. In this
operation,
integerExpression1 is divided by integerExpression2.
The resulting value of the entire expression is the integer remainder of the division. It always has
the sign of
integerExpression1.
This is an arithmetic operator with a precedence level of 4.
Example
This statement divides 7 by 4 and then displays the remainder in the Message window:
-- Lingo syntax
put(7 mod 4)