keeping keys of an array in the order they came in?

Klaus major-k klaus at major-k.de
Sat Aug 19 10:23:08 EDT 2017


Little addition, thanks hermann:

> Am 19.08.2017 um 15:44 schrieb Klaus major-k via use-livecode <use-livecode at lists.runrev.com>:
> 
> Hi Mike,
> 
> I added a little IF THEN clause to avoid doublettes in the ney key, too,
> and now it does what I need, thanks again!
> 
>> Am 19.08.2017 um 15:12 schrieb Klaus major-k via use-livecode <use-livecode at lists.runrev.com>:
>>> 
>>> put empty into tArray

## To avoid surpises with LINEOFFSET:
set the wholematches to TRUE

>>> repeat for each line tLine in tData
>>> put item 2 of tLine into tKey
>>> if tKey = EMPTY then next repeat
>>> put tLine & CR after tArray[tKey]

## So this will work as exspected:
> 
> if lineoffset(tKey,tArray["keylist"]) = 0 then
> put tKey & CR after tArray["keylist"]
> end if
> 
>>> ## put tKey & cr after tarray['myKeyList']
>>> end repeat

Best

Klaus

--
Klaus Major
http://www.major-k.de
klaus at major-k.de





More information about the Use-livecode mailing list