Insert (Stringlist function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
Line 1: | Line 1: | ||
{{Template:Stringlist:Insert subtitle}} | {{Template:Stringlist:Insert subtitle}} | ||
This callable method inserts a string into a Stringlist. | This callable method inserts a string into a <var>Stringlist</var>. | ||
==Syntax== | ==Syntax== | ||
Line 10: | Line 10: | ||
<td>A numeric variable to contain the number of items in '''%sl''' after the string has been inserted. </td></tr> | <td>A numeric variable to contain the number of items in '''%sl''' after the string has been inserted. </td></tr> | ||
<tr><th>sl </th> | <tr><th>sl </th> | ||
<td>A Stringlist object. </td></tr> | <td>A <var>Stringlist</var> object. </td></tr> | ||
<tr><th>itemnum </th> | <tr><th>itemnum </th> | ||
<td>The item number before which the string is to be inserted. If '''itemnum''' is equal to the number of items in the Stringlist plus one, '''string''' is added to the end of the Stringlist (the same effect as an Add invocation). Because the string is inserted before the indicated item number, '''itemnum''' is also the item number of the new Stringlist item after Insert returns. </td></tr> | <td>The item number before which the string is to be inserted. If '''itemnum''' is equal to the number of items in the <var>Stringlist</var> plus one, '''string''' is added to the end of the <var>Stringlist</var> (the same effect as an Add invocation). Because the string is inserted before the indicated item number, '''itemnum''' is also the item number of the new <var>Stringlist</var> item after Insert returns. </td></tr> | ||
<tr><th>string </th> | <tr><th>string </th> | ||
<td>A string that is to be inserted into the '''%sl''' Stringlist.</td></tr> | <td>A string that is to be inserted into the '''%sl''' <var>Stringlist</var>.</td></tr> | ||
</table> | </table> | ||
Line 20: | Line 20: | ||
<ul> | <ul> | ||
<li>All errors in Insert result in request cancellation. | <li>All errors in Insert result in request cancellation. | ||
<li>Before <var class=product>Sirius Mods</var> Version 6.6, it was a request canceling error to try to insert a longstring longer than the size limit of a Stringlist item: 6124 bytes. This limitation was eliminated in <var class=product>Sirius Mods</var> Version 6.6. | <li>Before <var class=product>Sirius Mods</var> Version 6.6, it was a request canceling error to try to insert a longstring longer than the size limit of a <var>Stringlist</var> item: 6124 bytes. This limitation was eliminated in <var class=product>Sirius Mods</var> Version 6.6. | ||
<li>An Insert can result in the splitting of a Stringlist leaf page. Once a leaf page is split, it will not be merged back together, even if subsequent [[RemoveItem (Stringlist function)]] invocations make this possible. Because of this splitting, heavy use of Insert and RemoveItem can result in "sparse" Stringlists which place an unnecessary burden on the buffer pool and CCATEMP. 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 (Stringlist function)]].</ul> | <li>An Insert can result in the splitting of a <var>Stringlist</var> leaf page. Once a leaf page is split, it will not be merged back together, even if subsequent [[RemoveItem (Stringlist function)]] invocations make this possible. Because of this splitting, heavy use of Insert and RemoveItem can result in "sparse" Stringlists which place an unnecessary burden on the buffer pool and CCATEMP. 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 (Stringlist function)]].</ul> | ||
[[Category:Stringlist methods|Insert function]] | [[Category:Stringlist methods|Insert function]] |
Revision as of 21:33, 18 January 2011
Insert strings into a Stringlist (Stringlist class)
This callable method inserts a string into a Stringlist.
Syntax
[%count =] sl:Insert( itemNum, itemList)
Syntax terms
%rc | A numeric variable to contain the number of items in %sl after the string has been inserted. |
---|---|
sl | A Stringlist object. |
itemnum | The item number before which the string is to be inserted. If itemnum is equal to the number of items in the Stringlist plus one, string is added to the end of the Stringlist (the same effect as an Add invocation). Because the string is inserted before the indicated item number, itemnum is also the item number of the new Stringlist item after Insert returns. |
string | A string that is to be inserted into the %sl Stringlist. |
Usage notes
- All errors in Insert result in request cancellation.
- Before Sirius Mods Version 6.6, it was a request canceling error to try to insert a longstring longer than the size limit of a Stringlist item: 6124 bytes. This limitation was eliminated in Sirius Mods Version 6.6.
- An Insert can result in the splitting of a Stringlist leaf page. Once a leaf page is split, it will not be merged back together, even if subsequent RemoveItem (Stringlist function) invocations make this possible. Because of this splitting, heavy use of Insert and RemoveItem can result in "sparse" Stringlists which place an unnecessary burden on the buffer pool and CCATEMP. 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 (Stringlist function).