ItemDifferenceList (Stringlist function)

From m204wiki
Jump to navigation Jump to search

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

  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 the 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, 2, '**')

    The resulting Stringlist %list3 has five items:

    TCP/IP CORBA TCP/IP IPX TCP/IP

See also