charToNum()
259
Parameters
stringExpression
Required. A string that specifies the expression from which a substring is
returned.
firstCharacter
Required. An integer that specifies the point at which the substring starts.
lastCharacter
Required. An integer that specifies the point at which the substring ends.
Example
This statement identifies the sixth character in the word
Macromedia
:
put chars("Macromedia", 6, 6)
-- "m"
This statement identifies the sixth through tenth characters of the word
Macromedia
:
put chars("Macromedia", 6, 10)
-- "media"
The following statement tries to identify the sixth through twentieth characters of the word
Macromedia. Because the word has only 10 characters, the result includes only the sixth through
tenth characters.
put chars ("Macromedia", 6, 20)
-- "media"
See also
char...of
,
length()
,
offset() (string function)
,
number (characters)
charToNum()
Usage
(
stringExpression
).charToNum
charToNum(
stringExpression
)
Description
Function (Lingo only); returns the ASCII code that corresponds to the first character of an
expression.
The
charToNum()
function is especially useful for testing the ASCII value of characters created by
combining keys, such as the Control key and another alphanumeric key.
Director treats uppercase and lowercase letters the same if you compare them using the equal sign
(
=
) operator; for example, the statement
put ("M" = "m")
returns the result 1 or
TRUE
.
Avoid problems by using
charToNum()
to return the ASCII code for a character and then use the
ASCII code to refer to the character.
In JavaScript syntax, use the String object’s
charCodeAt()
function.
Parameters
stringExpression
Required. A string that specifies the expression to test.
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...