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)
Содержание DIRECTOR MX 2004-DIRECTOR SCRIPTING
Страница 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Страница 48: ...48 Chapter 2 Director Scripting Essentials...
Страница 100: ...100 Chapter 4 Debugging Scripts in Director...
Страница 118: ...118 Chapter 5 Director Core Objects...
Страница 594: ...594 Chapter 12 Methods...
Страница 684: ...684 Chapter 14 Properties See also DVD...
Страница 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Страница 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Страница 889: ...netPresent 889 _player alert Sorry the Network Support Xtras could not be found See also Player...
Страница 1102: ...1102 Chapter 14 Properties...