keeping keys of an array in the order they came in?
jbv at souslelogo.com
Sat Aug 19 08:12:09 EDT 2017
I've been there and the only solution I found was to maintain
a second array :
put 0 into x
put "abc" into array1
add 1 to x
put 60 into array2[x]
put "xyz" into array1
add 1 to x
put 30 into array2[x]
put the keys of array2 into tkeys
sort lines of tkeys ascending numeric
repeat for each line j in tkeys
put array1[array2[j]] & return after myvar
You can also use a two-dimentional array instead
of 2 separate arrays...
On Sat, August 19, 2017 1:33 pm, Klaus major-k via use-livecode wrote:
> Hi dfriends,
> need a little help, I am filling an array (to eliminate doublettes) and
> really need to keep the order of the keys as they came in.
> put "60,30,40" into tK repeat for each item tItem in tK put "sdsdsdsddsd"
> into tArray[tItem] end repeat put the keys of tArray ...
> Now I would like to get:
> This is just an example, I cannot control the content of tK.
> Know what I mean?
> Any hints very welcome, thank you!
> Klaus Major
> klaus at major-k.de
> use-livecode mailing list use-livecode at lists.runrev.com Please visit this
> url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode