|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > LST. - List Arrays > List-Operations > Smart Package Robot (SPR) List Commands |
MiniRobotLanguage (MRL)
LST.DelPrev
Remove the node before a given node in a list
Intention
The LST.DelPrev command removes the node immediately before a specified reference node in a list. This is useful when you need to delete a specific node relative to another node in the list.
The command requires the list handle (`$$LST`) and the handle of the reference node (`$$NOD`). If the reference node is the first node in the list or the list is empty, the command will have no effect.
Syntax
LST.DelPrev|$$LST|$$NOD
Parameter Explanation
$$LST - The list identifier, typically a numeric value or a variable that contains a valid list handle.
$$NOD - The handle of the reference node. The node immediately before this node will be removed.
Example
'***********************************
' LST.DelPrev Sample Script
'***********************************
' Create a new list
LST.New|$$LST
' Add elements to the list
LST.Add|$$LST|Hello
LST.Add|$$LST|World
' Get the last node
LST.Last|$$LST|$$NOD
' Remove the node before the last node
LST.DelPrev|$$LST|$$NOD
' Verify the removal
LST.Count|$$LST|$$CNT
DBP. Number of nodes after removal: $$CNT
' Clean up
LST.End|$$LST
ENR.
Remarks
-
Limitations:
- The list must be initialized and contain at least two nodes.
- The reference node handle must be valid.
See also:
• LST.DelNext - Remove the Node After a Given Node