LIST.Swap

Previous  Next

 

count = LIST.Swap( lid  AS HANDLE,

                   lex1 AS INTEGER,

                   lex2 AS INTEGER ) AS INTEGER

 


 

Swaps the two elements of specified List.  Returns the number of items swapped.  If failed, the function returns 0 (no items swapped).

 

Example:

 

DIM hList AS HANDLE

 

hList = LIST.Create( "Kalle", STRING, "Nisse", REAL, 4 )

 

LIST.At( hList, 0, 0, "Kalle Anka      " )

LIST.At( hList, 0, 1, 1.234 )

LIST.At( hList, 1, 0, "Kajsa Anka      " )

LIST.At( hList, 1, 1, 2.345 )

LIST.At( hList, 2, 0, "Joakim von Anka " )

LIST.At( hList, 2, 1, 3.456 )

LIST.At( hList, 3, 0, "Farmor Anka     " )

LIST.At( hList, 3, 1, 4.567 )

 

' Swap Element 2 and 3

 

LIST.Swap( hList, 2, 3 )