[Gambas-user] sort multidimensional arrays

Fabien Bodard gambas.fr at ...626...
Sun Oct 25 23:32:48 CET 2009


what is the array structure ?

send an exemple please

2009/10/25 Matti <math.eber at ...221...>:
> Is there a way to sort an array that has more than one dimension by telling Gambas on which field the sorting shoiuld be done?
>
> For example, if I have the array
> Max, 14
> Anna, 8
> Fabien, 7
>
> I would expect the result of sorting by the first field to be
> Anna, 8
> Fabien, 7
> Max, 14
>
> Instead, when using Array.Sort, I get
> 7, 8
> 14, Anna
> Fabien, Max
>
> which is useless.
>
> I have a workaround now, reading the array into a single-dimensioned array like
> Max~14
> Anna~8
> Fabien~7
>
> and then sort it, which produces
> Anna~8
> Fabien~7
> Max~14
>
> and then split and read everything back to the original array:
> Anna, 8
> Fabien, 7
> Max, 14
>
> But that just works, it's not really elegant.
> Somebody knows a better way?
>
> Thanks
> Matti
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list