User Guide
226 Chapter 11: Keywords
word...of
Usage
-- Lingo syntax
member(whichCastMember).word[whichWord]
textMemberExpression.word[whichWord]
chunkExpression.word[whichWord]
word whichWord of fieldOrStringVariable
fieldOrStringVariable. word[whichWord]
textMemberExpression.word[firstWord..lastWord]
member(whichCastMember).word[firstWord..lastWord]
word firstWord to lastWord of chunkExpression
chunkExpression.word[whichWord..lastWord]
Description
Chunk expression; specifies a word or a range of words in a chunk expression. A word chunk is
any sequence of characters delimited by spaces. (Any non-visible character, such as a tab or
carriage return, is considered a space.)
The expressions
whichWord, firstWord, and lastWord must evaluate to integers that specify a
word in the chunk.
Chunk expressions refer to any character, word, item, or line in any source of characters. Sources
of characters include field and text cast members and variables that hold strings.
To see an example of
word...of used in a completed movie, see the Text movie in the Learning/
Lingo Examples folder inside the Director application folder.
Example
These statements set the variable named animalList to the string βfox dog catβ and then insert
the word elk before the second word of the list:
animalList = "fox dog cat"
put "elk" before animalList.word[2]
The result is the string βfox elk dog catβ.
This statement tells Director to display the fifth word of the same string in the Message window:
put "fox elk dog cat".word[5]
Because there is no fifth word in this string, the Message window displays two quotation marks
(""), which indicate an empty string.
See also
char...of, line...of, item...of, count(), number (words)