Searching Text- Use Variables

> Has anybody found a way to search multiple text cast
> members and displaying>the found word?? I've done it, but
> it's sloooooow on a mac and faster on a PC - on the PC it
> takes 1.5 to 2 minutes on the mac 4-5 minutes to search 10
> big text fields. 
Do all of your searching and processing in memory variables, not directly in the text field.
on findLine searchText
  set found = 0
  set myData = field "MyData"
  repeat with i = 1 to (the number of lines in myData)
    if line i of myData = searchText then
      set found = i
      exit repeat
    end if
  end repeat
  return found
end findLine
...or something like that! Just make sure to not reference a text field inside of a repeat loop and you will have much better performance.
Tauren
Tauren Mills        * tauren@cs.pdx.edu  * Pager: 503-497-2794
White Horse Studios * 1634 SW Alder      * Phone: 503-222-0116
whthrs@teleport.com * Portland, OR 97205 * Fax:   503-222-3658
               http://www.teleport.com/~whthrs/
 Audio * Video * Interactive Multimedia * Animation * More...


 
Date:    Tue, 21 Feb 1995 18:21:09 -0800
From:    Jon Gorrono <jpgorrono@UCDAVIS.EDU>
Subject: Re: searching _and_ displaying the found item
Just a note that that the difference in processing time largely disappears if you save the cast number of the named text cast. The point being that to repeatedly look for a cast member named "MyData", as in the above example, is what takes up most of the time.

I only mention this because usually, I need to use a cast number reference multiple times in a routine, in addition to the field text.