
Use the list commands to index Director text chunks for operations where you otherwise would
have to refer back to the text itself. For instance you can use GetListOfWords to speed up a
proximity search (word 1 within so many words of word 2). List commands like:
if getAt(wordList,5) = secondword
are faster than text chunk commands like:
if word 5 of field "whatever" = secondword
GetListOfWords(sourceString) - where sourceString is the string to operate on. Returns a list of
character chunks delimited by white space or empty list if there was an error. Returns a list of
character chunks in the string delimited by white space. White space includes TAB(9),
Linefeed(10) and Return(13).
Example:
on makeIndex thestring
-- Create an alphabetical index of the words
-- in a text chunk
--
set index = [:]
set thestring = ToLowerCase(thestring)
set wordList = GetListOfWords(thestring)
if TC_GetLastError() = 0 then
set numWords = count(wordList)
repeat with w = 1 to numWords
set thisword = getAt(wordList,w)
if voidP(getaprop(index,thisword)) then
addprop index,thisword,list(w)
Online Help
37
Kommentare zu diesen Handbüchern