Lasso Soft Inc. > Home

[Array->Remove]

[Array->Remove] removes an item from the array. Accepts a single integer parameter identifying the index of the item to be removed. Defaults to the last item in the array. Returns no value.

The first element in an array is at index 1. An error is returned if the index specified is beyond the size of the array.

Note: The specified element in the array is removed and the indexes of all elements in the array above the index are adjusted down by one. Use an [Array->Get] tag to clear out an element of the array.

  • Syntax
  • Parameters
[Array->(Remove: Array Index)]
Required Parameters
Array The array to be operated upon.
Array Index The index of the element which should be removed from the array.
Examples

To remove an element from an array:

Use the [Array->Remove] tag. The following example removes the third element, Tue, from an array of the days of the week. The remainder of the array is output.

<?LassoScript
  Variable: 'DaysOfWeek'=(Array: 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
  $DaysOfWeek->(Remove: 3);
  Output: $DaysOfWeek;
?>
Result:
(Array: (Sun), (Mon), (Wed), (Thu), (Fri), (Sat))
Tag Link [Array->Remove] Category Array
Type Member Data Source Any
Support Preferred Version 5.0
Output Type None Security None
Implementation Sets Lasso 5.0

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft