[Gambas-user] Swap function for arrays

Gianluigi bagonergi at gmail.com
Wed Jun 6 11:29:26 CEST 2018


But swap function already exist.
I believe that based on this example [0], we can make our own generic
function.

Regards
Gianluigi

[0] http://gambaswiki.org/wiki/comp/gb.qt4/gridview/sorted

2018-06-06 11:16 GMT+02:00 <d4t4full at gmail.com>:

> I guess SWAP or EXCHANGE would better represent the intention of
> exchanging two items or blocks of items.
>
> zxMarce.
> On Jun 6, 2018, at 05:09, Rolf-Werner Eilert <rwe-sse at osnanet.de> wrote:
>>
>> Ever so often I have to pick an entry from an array or a table and set
>> it to another position. Mostly this happens when the GUI offers an
>> upward and downward button.
>>
>> Each time I have to find a practical solution for my code, invent the
>> wheel if you want so, to
>>
>> - store the contents of the array
>> - put it to its new position
>> - delete it at its old position
>>
>> So a ready-made function for this would be nice, and alongside we could
>> even have a broader concept by allowing for whole blocks to be pushed.
>>
>> Don't know which word is best for this in English, maybe push or skip or
>> slide... If it was push, it might be used like
>>
>> myArray.Push(FromPosition, ToPosition, Length)
>>
>> What do you think?
>>
>> Regards
>> Rolf
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>
>>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180606/e35cc190/attachment.html>


More information about the User mailing list