MergeLists()

Syntaxe

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.

Arguments

SourceList() Specifies the list from which the elements will be taken. This list will be empty after the function returns.
DestinationList() Specifies the list to move the elements to. This list will contain the items of both lists after the function returns.
Location (optional) Specifies 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()

Valeur de retour

This function has no return value.

Exemple

  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()

OS Supportés

Tous

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