This is a LotusScript version of a List comparing function @Keywords. It is enhanced to return another result other than with @Keywords. The documentation within the code is self-explanatory.
Code
Function LSKeywords( ssLSKCList1
As Variant, ssLSKCList2 As Variant,
vLSKCompFlag As Variant ) As Variant
%REM
Args : ssLSKList1 - List1 to check
ssLSKList2 - List2 to check
vLSKCompFlag - Flag to tell the mode
of checking, check Desc for more details.
Desc : Extended function of @Keywords :
if vLSKCompFlag is true - returns only
those items from
the second list that are found in the first
list else returns only those items from
the first list that are not found in the
second list
Function Call e.g.
LSKeywords( "3":"4":"5":"8":"4" , "5":
"6":"4":"7" , True ) returns "4":"5"
LSKeywords( "3":"4":"5":"8":"4" , "5":
"6":"4":"7" , False ) returns "3":"8"
Called at : widely used
Calls : None
%END REM
Dim ssLSKCRtnList( ),
ssLSKRtnList( ), vLSKC As Variant
Dim iLSKC, iLSK As Integer
iLSKC = 0
Redim Preserve ssLSKCRtnList
( iLSKC ) As Variant
iLSK = 0
Redim Preserve ssLSKRtnList
( iLSK ) As Variant
Forall x In ssLSKCList1
vLSKC = True
Forall y In ssLSKCList2
If x = y Then
vLSKC = False
Redim Preserve ssLSKRtnList
( iLSK ) As Variant
ssLSKRtnList( iLSK ) = y
iLSK = iLSK + 1
End If
End Forall
If vLSKC Then
Redim Preserve ssLSKCRtnList
( iLSKC ) As Variant
ssLSKCRtnList( iLSKC ) = x
iLSKC = iLSKC + 1
End If
End Forall
If vLSKCompFlag Then
LSKeywords = ssLSKRtnList
Else
LSKeywords = ssLSKCRtnList
End If
End Function