keeping keys of an array in the order they came in?
jbv
jbv at souslelogo.com
Sat Aug 19 08:12:09 EDT 2017
Hi Klaus
I've been there and the only solution I found was to maintain
a second array :
put 0 into x
put "abc" into array1[60]
add 1 to x
put 60 into array2[x]
put "xyz" into array1[30]
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
end repeat
You can also use a two-dimentional array instead
of 2 separate arrays...
jbv
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.
>
> Example:
> ...
> 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:
> 60
> 30
> 40
>
>
> This is just an example, I cannot control the content of tK.
> Know what I mean?
>
>
> Any hints very welcome, thank you!
>
>
>
> Best
>
>
> Klaus
>
>
> --
> Klaus Major
> http://www.major-k.de
> 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:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
More information about the use-livecode
mailing list