[Gambas-user] Sort multidimensional array?
Rolf-Werner Eilert
rwe-sse at ...3629...
Tue Feb 7 10:55:01 CET 2017
Hi Matti,
I don't find your method so dirty - I have used it a lot of times
myself. And I use it in table-like arrays with more than 2 columns, all
as strings.
However, I use a character which does not appear in normal strings, like
TAB (chr$(9)) or chr$(6).
To pack and unpack a single line, I use Split and Join which work so
incredibly fast they can be used within milliseconds over thousands of
strings.
As my rule of thumb, when I have a fixed number of columns, I make a
number of named one-dimensional arrays, one for each column. If the
number of columns is not known, I make a single one-dimensional array of
strings and split the columns as described above.
Regards
Rolf
Am 06.02.2017 23:26, schrieb Matti:
> Hi Riccardo,
>
> this is a question I had long years ago. At this time it was not possible.
> As I remember, I used a dirty workaround, reducing the
> two-dimensionsional array by inserting a "/" to a one-dimensional array,
> sorting it and removing the "/" later.
>
> Depends on what array you have to sort.
>
> Example for the workaround is attatched. Look at the FMain 'mnuSortA'
> and 'mnuSortT' Subs.
>
> Hope this helps, but I'm really not up to date.
>
> Matti
>
> Am 06.02.2017 um 22:23 schrieb Riccardo:
>> Hi,
>>
>> Is it possible to use the array.sort() method on a two-dimensional array?
>>
>>
>>
>>
>>> Public arr_Response As New String[][]
>>>
>>
>>
>>
>> Specifically, I'd like to sort the entire array based on the contents
>> of the second column something like: arr_Response[][1].sort() ...
>>
>>
>>
>>
>> cheers.
>>
>> ------------------------------------------------------------------------------
>>
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> 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