ItemDifferenceList (Stringlist function): Difference between revisions
m (1 revision) |
m (→Syntax terms) |
||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Stringlist:ItemDifferenceList subtitle}} | {{Template:Stringlist:ItemDifferenceList subtitle}} | ||
This method determines which items in a <var> | This method determines which items in a <var>stringlist</var> do not appear as an entry in a separator-delimited item in a second <var>stringlist</var>, and it places them on an output <var>stringlist</var>. In some sense, the output <var>stringlist</var> is the "difference" between a <var>stringlist</var> and a separator-delimited <var>stringlist</var> item. | ||
==Syntax== | ==Syntax== | ||
Line 7: | Line 7: | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%outList</th> | ||
<td>This <var> | <td>This <var>stringlist</var> contains the items from <var class="term">sl</var> that do not appear in the specified item in <var class="term">sl1</var>. </td></tr> | ||
<tr><th>sl</th> | <tr><th>sl</th> | ||
<td>A <var> | <td>A <var>stringlist</var> object. </td></tr> | ||
<tr><th>sl1</th> | <tr><th>sl1</th> | ||
<td>The identifier of a <var>Stringlist</var> | <td>The identifier of a <var>Stringlist</var> containing the item that is a delimiter-separated string to be scanned for each item from the method <var>stringlist</var>, <var class="term">sl</var>. </td></tr> | ||
<tr><th> | |||
<td>The number of the item from | <tr><th>itemNum</th> | ||
<td>The number of the item from <var class="term">sl1</var> that is a delimiter-separated string to be scanned for each item from <var class="term">sl</var>. Each <var class="term">sl</var> item that does not appear in the delimiter-separated string becomes an item in the resultant <var>stringlist</var>, <var class="term">%outList</var>. </td></tr> | |||
<tr><th>separator</th> | <tr><th>separator</th> | ||
<td>The delimiter character or characters to be used in the scanning of the indicated <var> | <td>The delimiter character, or characters, to be used in the scanning of the indicated <var>stringlist</var> item. This optional argument defaults to comma (<tt>,</tt>), and cannot be the null string. Specifying <var class="term">separator</var> as a null string is the same as not specifying the argument or as specifying it as a comma.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>All errors in ItemDifferenceList result in request cancellation. | <li>All errors in <var>ItemDifferenceList</var> result in request cancellation. | ||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
<ol> | <ol> | ||
<li>As an example of the use of this method, suppose <var>Stringlist</var> %list1 contained these six items: | <li>As an example of the use of this method, suppose <var>Stringlist</var> <code>%list1</code> contained these six items: | ||
< | <p class="code">BBB | ||
BBB | |||
CC | CC | ||
DDDD | DDDD | ||
Line 35: | Line 38: | ||
E | E | ||
FFF | FFF | ||
</ | </p> | ||
Suppose <var>Stringlist</var> %list2 contained two items: | Suppose <var>Stringlist</var> <code>%list2</code> contained two items: | ||
< | <p class="code">X,Y,Z, | ||
X,Y,Z, | |||
AAA,DDDD,FFF, | AAA,DDDD,FFF, | ||
</ | </p> | ||
If this is the ItemDifferenceList invocation: | If this is the <var>ItemDifferenceList</var> invocation: | ||
< | <p class="code">%list3 = %list1:itemDifferenceList(%list2, 2) | ||
%list3 = %list1:itemDifferenceList(%list2, 2) | </p> | ||
</ | |||
The resulting %list3 has three items: | The resulting <code>%list3</code> has the three items: | ||
< | <p class="code">BBB | ||
BBB | |||
CC | CC | ||
E | E | ||
</ | </p> | ||
<li>If a value occurs multiple times in the first object <var>Stringlist</var>, it will appear the same number of times in the output <var>Stringlist</var> or not at all, depending on whether it appears in the separator-delimited item in the first argument <var>Stringlist</var>. | <li>If a value occurs multiple times in the first object <var>Stringlist</var>, it will appear the same number of times in the output <var>Stringlist</var> or not at all, depending on whether it appears in the separator-delimited item in the first argument <var>Stringlist</var>. | ||
For example, if <var>Stringlist</var> %list1 contained these eight items: | For example, if <var>Stringlist</var> <code>%list1</code> contained these eight items: | ||
< | <p class="code">TCP/IP | ||
TCP/IP | |||
SNA | SNA | ||
CORBA | CORBA | ||
Line 71: | Line 70: | ||
IPX | IPX | ||
TCP/IP | TCP/IP | ||
</ | </p> | ||
And if <var>Stringlist</var> %list2 contained these three items: | And if <var>Stringlist</var> <code>%list2</code> contained these three items: | ||
< | <p class="code">Y2K**SECURITY**PRODUCTIVITY**METRICS** | ||
Y2K**SECURITY**PRODUCTIVITY**METRICS** | |||
IND$FILE**LU6.2**SNA**MQSERIES**LU2** | IND$FILE**LU6.2**SNA**MQSERIES**LU2** | ||
GIF**JPEG**WAV**PDF**HTML** | GIF**JPEG**WAV**PDF**HTML** | ||
</ | </p> | ||
And if this is the ItemDifferenceList invocation: | And if this is the <var>ItemDifferenceList</var> invocation: | ||
< | <p class="code">%list3 = %list1:itemDifferenceList(%list2, 2, '**') | ||
%list3 = %list1:itemDifferenceList(%list2, ' | </p> | ||
</ | |||
The resulting <var>Stringlist</var> %list3 has five items: | The resulting <var>Stringlist</var> <code>%list3</code> has five items: | ||
< | <p class="code">TCP/IP | ||
TCP/IP | |||
CORBA | CORBA | ||
TCP/IP | TCP/IP | ||
IPX | IPX | ||
TCP/IP | TCP/IP | ||
</ | </p> | ||
</ol> | </ol> | ||
==See also== | |||
{{Template:Stringlist:ItemDifferenceList footer}} |
Latest revision as of 15:41, 31 October 2012
Compare Stringlist to delimited Stringlist item (Stringlist class)
This method determines which items in a stringlist do not appear as an entry in a separator-delimited item in a second stringlist, and it places them on an output stringlist. In some sense, the output stringlist is the "difference" between a stringlist and a separator-delimited stringlist item.
Syntax
%outList = sl:ItemDifferenceList( sl1, itemNum, [separator])
Syntax terms
%outList | This stringlist contains the items from sl that do not appear in the specified item in sl1. |
---|---|
sl | A stringlist object. |
sl1 | The identifier of a Stringlist containing the item that is a delimiter-separated string to be scanned for each item from the method stringlist, sl. |
itemNum | The number of the item from sl1 that is a delimiter-separated string to be scanned for each item from sl. Each sl item that does not appear in the delimiter-separated string becomes an item in the resultant stringlist, %outList. |
separator | The delimiter character, or characters, to be used in the scanning of the indicated stringlist item. This optional argument defaults to comma (,), and cannot be the null string. Specifying separator as a null string is the same as not specifying the argument or as specifying it as a comma. |
Usage notes
- All errors in ItemDifferenceList result in request cancellation.
Examples
- As an example of the use of this method, suppose Stringlist
%list1
contained these six items:BBB CC DDDD AAA E FFF
Suppose Stringlist
%list2
contained two items:X,Y,Z, AAA,DDDD,FFF,
If this is the ItemDifferenceList invocation:
%list3 = %list1:itemDifferenceList(%list2, 2)
The resulting
%list3
has the three items:BBB CC E
- If a value occurs multiple times in the first object Stringlist, it will appear the same number of times in the output Stringlist or not at all, depending on whether it appears in the separator-delimited item in the first argument Stringlist.
For example, if Stringlist
%list1
contained these eight items:TCP/IP SNA CORBA MQSERIES SNA TCP/IP IPX TCP/IP
And if Stringlist
%list2
contained these three items:Y2K**SECURITY**PRODUCTIVITY**METRICS** IND$FILE**LU6.2**SNA**MQSERIES**LU2** GIF**JPEG**WAV**PDF**HTML**
And if this is the ItemDifferenceList invocation:
%list3 = %list1:itemDifferenceList(%list2, 2, '**')
The resulting Stringlist
%list3
has five items:TCP/IP CORBA TCP/IP IPX TCP/IP