[Gambas-user] Swap function for arrays

Charlie Ogier charlie at cogier.com
Wed Jun 6 16:29:24 CEST 2018


Try this. It will correct the "8" & "7" in one line: -

*Public Sub Form_Open()**
**Dim sArray As String[] = ["0", "1", "2", "3", "4", "5", "6", "8", "7", 
"9"] **
**
**sArray.add(sArray.Extract(7)[0], 8)**
**
**Print sArray.Join(" ")**
**
**End**
*
Charlie


On 06/06/18 10:41, Rolf-Werner Eilert wrote:
>
> Am 06.06.2018 um 11:16 schrieb d4t4full at gmail.com:
>> I guess SWAP or EXCHANGE would better represent the intention of 
>> exchanging two items or blocks of items.
>>
>> zxMarce.
>
> I thought so too, but... after all, it's not a swapping or exchanging, 
> I don't want to exchange or swap TWO items but only set ONE item to a 
> new position.
>
> Hard to find a word for it. In German it is "verschieben" whereas 
> "schieben" means "to push" and "ver..." means "away" or "to another 
> place".
>
> Maybe "move" would match it?
>
> Regards
> Rolf
>
>
>
>
> ----[ 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/0bc8d617/attachment.html>


More information about the User mailing list