[Gambas-user] Swap function for arrays

Rolf-Werner Eilert rwe-sse at osnanet.de
Wed Jun 6 10:10:44 CEST 2018


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


More information about the User mailing list