[Gambas-user] Re: How to sort an array?
adam krell
akrell at ...43...
Sat Feb 14 18:04:12 CET 2004
Thanks for everybody's help. My simple goal was to
use a columnview for some data and have it sort on the
column that has integer data in it. I couldn't do
this since it only sorts alphanumerically. I tried
adding the leading spaces but I couldn't get that to
work. Perhaps I was doing something wrong.
So, I created an array of a selfdefined datatype
because the data was of various types and I understood
that this is how gambas handles that (being there is
no "struct" type). I can use the bubble sort to sort
the array and then populate the columnview. However,
I see that Benoit mentions that I could use a sort()
method on the array. I couldn't find the
documentation on this method. Can it be used with an
array of objects and the ability to specify the part
of the datatype I'd like the array to sort on?
Or perhaps I'm approaching this all the wrong way.
Any help is appreciated. BTW, Benoit, thank you for
making gambas. It is really fun to use and very
useful.
-Adam
>> On Friday 13 February 2004 16:23, adam krell
wrote:
>> Is there an easy way to sort an array of integers?
>> I'd do it in a columnview column but it only sorts
>> text alphanumerically, I believe.
>>
>> Thanks,
>>
>> Adam
>>
>You can sort any array with the Sort() method.
>When the array is a string array, Sort() takes one
>argument that indicates what sort of comparison you
>want (binary, case insensitive, system charset
aware)
>and if you want an ascent or descent sort.
>
>Regards,
>
>--
>Benoit Minisini
>mailto:gambas at ...362...
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
More information about the User
mailing list