AW: order of array is different after split

Tiemo Hollmann TB toolbook at kestner.de
Tue May 21 06:08:30 EDT 2013


Hi Mark,
"any comments" was indeed a bit open.
But you have answered my question, that the keys in an array are indeed not
sorted like the source list and thanks for the appropriate workaround.
Tiemo

> -----Ursprüngliche Nachricht-----
> Von: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] Im
Auftrag
> von Mark Schonewille
> Gesendet: Dienstag, 21. Mai 2013 12:00
> An: How to use LiveCode
> Betreff: Re: order of array is different after split
> 
> Hi Tiemo,
> 
> Since you're just asking for comments, I'm not sure what kind of answer
> you're looking for but I'll try.
> 
> To process an array in sorted order, you can put the keys into a variable:
> 
> put the keys of myArray into myKeys
> sort the lines of myKeys ascending international repeat for each line
myKey
> in myKeys
>    // do something with myArray[myKey]
> end repeat
> 
> This processes the array in internationally sorted order.
> 
> --
> Best regards,
> 
> Mark Schonewille
> 
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
> 
> Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour
> spaces. http://www.color-converter.com
> 
> Buy my new book "Programming LiveCode for the Real Beginner"
> http://qery.us/3fi
> 
> On 5/21/2013 11:46, Tiemo Hollmann TB wrote:
> > Hi,
> >
> > when splitting a plain list into an array, the order of the array is
> > different to the source list. E.g. if the list was sorted
> > international, the array is sorted standard. Is this a standard
> > behavior of split, or do I have any options on the array order.
> >
> > I know, as far as you access the array by its keys, the order isn't
> > relevant, but sometimes it might by suitable to process the array in
> > sequence and then it could be valuable if the sequence is the same as
> > the origin.
> >
> >
> >
> > Any comments?
> >
> > Tiemo
> >
> >
> >
> >
> >
> > _______________________________________________
> > 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
> >
> 
> _______________________________________________
> 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