shilling for my feature request [1926]

Mark Brownell gizmotron at earthlink.net
Mon Aug 23 10:12:49 EDT 2004


On Monday, August 23, 2004, at 01:44 AM, Alex Tweedly wrote:

> Two messages back in this thread, I said  " .if you have [thousands], 
> then I would try out a binary search ..."
> meaning "write a binary search function and try it out".  No 
> undocumented features here.
>
> Now that I'm interested (fatal for me), I'm going to try it myself - 
> so look for a post from me later today with a simple binarysearch 
> function, and some timing results.
>
> -- Alex.

Here is the origin of my interest if you are interested.

-- put getElements("<record>", "</record>", tStringVar) into theArray

function getElements tStartTag, tEndTag, StringToSearch
   put empty into tArray
   put 0 into tStart1
   put 0 into tStart2
   put 1 into tElementNum
   put the number of chars in tStartTag into dChars
   repeat
     put offset(tStartTag,StringToSearch,tStart1) into tNum1
     put (tNum1 + tStart1) into tStart1
     if tNum1 < 1 then exit repeat
     put offset(tEndTag,StringToSearch,tStart2) into tNum2
     put (tNum2 + tStart2) into tStart2
     if tNum2 < 1 then exit repeat
     --if tNum2 < tNum1 then exit repeat
     put char (tStart1 + dChars) to (tStart2 - 1) of StringToSearch into 
zapped
     put zapped into tArray[tElementNum]
     add 1 to tElementNum
   end repeat
   return tArray
end getElements

Mark



More information about the use-livecode mailing list