SplitList()

Syntax

SplitList(SourceList(), DestinationList() [, KeepCurrent])
Description
Moves the elements in SourceList() from the current element onwards to the DestinationList(). This is a fast operation because the element data itself is not moved to split the list.

Parameters

SourceList() The list from which the elements will be split. The current element of this list specifies the point at which to split the list. If there is no current element, then all elements remain in SourceList().
DestinationList() The list to move the elements to. Any existing elements in this list are deleted before the new elements are added.
KeepCurrent (optional) Whether the current item in SourceList() remains in SourceList() or is moved to DestinationList(). If this parameter is #True, then the current element remains in SourceList(). If it is #False (default), then the current element is moved to DestinationList().

Return value

None.

Remarks

If 'KeepCurrent' is set to #True then the new current element in SourceList() will be the previous element of the list. If there is no previous element then the list will no longer have a current element after this function returns. The DestinationList() will have no current element.

Example

  NewList A()
  NewList B()
  
  For i = 0 To 10
    AddElement(A())
    A() = i
  Next i
  
  ; split A() at element 5 and move the remaining elements to B()
  SelectElement(A(), 5)
  SplitList(A(), B())
  
  
  Debug " -- A() -- "
  ForEach A()
    Debug A()
  Next
  
  Debug " -- B() -- "
  ForEach B()
    Debug B()
  Next

See Also

MergeLists()

Supported OS

All

<- SelectElement() - List Index - SwapElements() ->