Search Values of Array in "One Go"

Bob Sneidar bobsneidar at iotecdigital.com
Thu Aug 24 14:10:42 EDT 2017


Okay it's not entirely straight forward. I took a simple array from a datagrid with one record and ran this on it:

on mouseUp pButtonNumber
   put the dgData of group "dgsites" into aSiteData
   put arrayencode(aSiteData) into tSiteData
   repeat for each char tChar in tSiteData
      add 1 to tCounter
      if cleanAscii(tChar) is not empty then next repeat
      put tCounter & tab & charToNum(tChar) & cr after tAscii
   end repeat
   set the itemDelimiter to tab
   sort lines of tAscii numeric by item 2 of each
   put tAscii
end mouseUp

This returns a tab delimited list of position and non-printing ascii characters ranging from 0 to 58. What the ascii characters designate is the mystery. Any documentation on that? 

Bob S


> On Aug 24, 2017, at 10:50 , Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I suppose thinking about it you could arrayencode an array then do a search on it, but I am not sure how you would discern the array keys. I'll have to look at the encoded format. At that point if that approach worked, the only advantage to searching a memory based array is you would be skipping the encoding step, and searching the actual array in memory with the engine might be considerably faster than having LC search a text variable. 
> 
> I'll play around with it to see what I can come up with. 
> 
> Bob S





More information about the use-livecode mailing list