RemoveItem (Stringlist function)

From m204wiki
Jump to navigation Jump to search

Remove item from Stringlist (Stringlist class)


This callable method removes an item from a Stringlist, decrementing the item numbers of all items which follow. If removal of an item makes a CCATEMP Stringlist page empty, that page is removed from use by the Stringlist. Otherwise, space taken up by a removed item is made available on the Stringlist page for other items in the same Stringlist.

Syntax

[%count =] sl:RemoveItem( itemNum)

Syntax terms

%count An optional, numeric variable to contain the number of items remaining in the Stringlist after the item has been removed.
sl A Stringlist object.
itemNum A number that specifies the item number in the Stringlist to be removed.

Usage notes

  • All errors in RemoveItem result in request cancellation.
  • Consecutive Stringlist leaf pages that are made relatively empty with RemoveItem will not be merged together. Because of this, heavy use of Insert and RemoveItem can result in "sparse" Stringlists which place an unnecessary burden on the buffer pool and CCATEMP.
  • Heavy use of Insert and RemoveItem can result in an inability to add an item to the end of the Stringlist (via the Add method) because of a full pointer page, even though the Stringlist is nowhere near the theoretical capacity for a Stringlist. To make matters worse, Copy does a page-for-page copy of a Stringlist, so it does not result in any compression of the resultant Stringlist. Stringlist compression can be achieved using the CopyItems.

See also