ItemDifferenceList (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 1: Line 1:
{{Template:Stringlist:ItemDifferenceList subtitle}}
{{Template:Stringlist:ItemDifferenceList subtitle}}


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.
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 8: Line 8:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%outlist </th>
<tr><th>%outlist </th>
<td>This Stringlist contains the items from '''%sl''' that do not appear in the specified item in '''sl1'''. </td></tr>
<td>This <var>Stringlist</var> contains the items from '''%sl''' that do not appear in the specified item in '''sl1'''. </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>sl1 </th>
<tr><th>sl1 </th>
<td>The identifier of a Stringlist that contains the item that contains a delimiter-separated string that is to be scanned for each item from the method Stringlist, '''%sl'''. </td></tr>
<td>The identifier of a <var>Stringlist</var> that contains the item that contains a delimiter-separated string that is to be scanned for each item from the method <var>Stringlist</var>, '''%sl'''. </td></tr>
<tr><th>itemnum </th>
<tr><th>itemnum </th>
<td>The number of the item from '''%sl1''' that contains a delimiter-separated string that is 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'''. </td></tr>
<td>The number of the item from '''%sl1''' that contains a delimiter-separated string that is 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 <var>Stringlist</var>, '''%outlist'''. </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 Stringlist item. This optional argument defaults to comma (<tt>.,</tt>), and it 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.</td></tr>
<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 it 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.</td></tr>
</table>
</table>


Line 26: Line 26:
==Examples==
==Examples==
<ol>
<ol>
<li>As an example of the use of this method, suppose Stringlist %list1 contained these six items:
<li>As an example of the use of this method, suppose <var>Stringlist</var> %list1 contained these six items:


<pre>
<pre>
Line 37: Line 37:
</pre>
</pre>


Suppose Stringlist %list2 contained two items:
Suppose <var>Stringlist</var> %list2 contained two items:


<pre>
<pre>
Line 58: Line 58:
</pre>
</pre>


<li>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.  
<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 Stringlist %list1 contained these eight items:
For example, if <var>Stringlist</var> %list1 contained these eight items:


<pre>
<pre>
Line 73: Line 73:
</pre>
</pre>


And if Stringlist %list2 contained these three items:
And if <var>Stringlist</var> %list2 contained these three items:


<pre>
<pre>
Line 87: Line 87:
</pre>
</pre>


The resulting Stringlist %list3 has five items:
The resulting <var>Stringlist</var> %list3 has five items:


<pre>
<pre>

Revision as of 21:33, 18 January 2011

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 that contains the item that contains a delimiter-separated string that is to be scanned for each item from the method Stringlist, %sl.
itemnum The number of the item from %sl1 that contains a delimiter-separated string that is 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 it 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

  1. 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 three items:

    BBB
    CC
    E
    
  2. 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, '++')
    

    The resulting Stringlist %list3 has five items:

    TCP/IP
    CORBA
    TCP/IP
    IPX
    TCP/IP