wordOffset, repeat loop, speed?

Ken Ray kray at sonsothunder.com
Sun Jan 5 15:43:00 EST 2003


Mark,

Yes, I would say so. Rev is very fast, so if you did something like:

-- gWordArray is the array that will be produced after the words are found
-- gData is the "whole chunk of text" you referred to as the main container

global gWordArray, gData

on mouseUp
  ask "What word do you want to find?"
  if it <> "" then
    FindWord it,gData
    -- you now have an array where each element is the numeric offset to the
    -- word to be found in gData
  end if
end mouseUp

on FindWord pWord,pData
    set the wholeMatches to true
    put 0 into tStart
    put 1 into tElementNum
    repeat forever
        put wordOffset(pWord,pData,tStart) into tNum
        if tNum = 0 then exit repeat
        put tNum into gWordArray[tElementNum]
        add 1 to tElementNum
    end repeat
end FindWord

Hope this helps,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: "Mark Brownell" <gizmotron at earthlink.net>
To: <use-revolution at lists.runrev.com>
Sent: Sunday, January 05, 2003 1:21 PM
Subject: wordOffset, repeat loop, speed?


> Hi,
> I'm brand new to Runtime Revolution, just coming over from Director having
> discovered this very cool app and hoping it lives up to what it says it
can
> do. I've already had the pleasure of disappointment caused by trying to
> create Windows apps with Realbasic. Does anyone want a pro-license for
> Realbasic 3? I doubt it very much. Anyway, I'm wondering about this
handler
> I need to build, and I'm wondering about the fastest way to have it parse
> large amounts of text.
>
> Would using "wordOffset(wordToFind,stringToSearch[,wordsToSkip])" in a
> repeat loop, to create a list of numerical values for reoccurring
instances
> of the same word found from within the whole chunk of text, be the fastest
> way to get a list of these words. When I refer to lists, I mean the
> Director/Lingo kind. In RR it might be that an array is what I am
referring
> to. I want to create a pull parser based on numerical values that I can
> access at a very fast speed. Perhaps there is a command that creates these
> lists all at once without a repeat loop; something like
> "findAllwordOffset()" ?
>
>
> Thanks for any advice,
> Mark Brownell
> Gizmotron Graphics
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list