MergeLists()

Syntax

MergeLists(SourceList(), DestinationList() [, Location])
Description
Moves all elements from the SourceList() to the DestinationList(). This is a fast operation because the element data itself is not moved to merge the two lists.

Parameters

SourceList() The list from which the elements will be taken. This list will be empty after the function returns.
DestinationList() The list to move the elements to. This list will contain the items of both lists after the function returns.
Location (optional) Location where to insert the elements in the DestinationList(). This can be one of the following values:
  #PB_List_First : Insert the elements at the beginning of DestinationList()
  #PB_List_Last  : Append the elements at the end of DestinationList()
  #PB_List_Before: Insert the elements before the current element of DestinationList()
  #PB_List_After : Insert the elements after the current element of DestinationList()

Return value

None.

Example

  NewList A.s()
  AddElement(A()): A() = "a0"
  AddElement(A()): A() = "a1"
  AddElement(A()): A() = "a2"
  AddElement(A()): A() = "a3"
  
  NewList B.s()
  AddElement(B()): B() = "b0"
  AddElement(B()): B() = "b1"
  AddElement(B()): B() = "b2"
  AddElement(B()): B() = "b3"
    
  ; Insert the elements of A() before the "b1" element in B()
  SelectElement(B(), 1)
  MergeLists(A(), B(), #PB_List_Before)
  
  ForEach B()
    Debug B()
  Next

See Also

SplitList()

Supported OS

All

<- ListSize() - List Index - MoveElement() ->