;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       ListCompare() 
;; 
;;ACTION         Compares two delimited lists and returns a pair of arrays of what's missing 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0 - 2020/07/29 
;; 
;;HISTORY        1.0 - 2020/07/29 - Initial Release 
;; 
;;SYNTAX         ListCompare(List1, List2, Delimiter) 
;; 
;;PARAMETERS     List1 - REQUIRED - a delimited list string 
;;               List2 - REQUIRED - a delimited list string 
;;               Delimiter - REQUIRED - the delimiter character 
;; 
;;REMARKS        Compares two delimited lists and identifies values in one missing from the other 
;; 
;;RETURNS        Complex Array: 
;;               Result[0] = array of items in List 2 missing from List 1 
;;               Result[1] = array of items in List 1 missing from List 2 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K16, W2K19, W10 
;; 
;;EXAMPLES        
; 
Function ListCompare($_List1, $_List2, $_Delimiter)
 
  Dim $_P, $_M					;  
  Dim $_aL1, $_aL2, $_aC1, $_aC2		; list and compare arrays 
  Dim $_aCompare[1]
 
  ; represent lists as array 
  $_aL1 = Split($_List1, $_Delimiter)
  $_aL2 = Split($_List2, $_Delimiter)
 
  $_M = -1
  For $_P = 0 to UBound($_aL1)
    If AScan($_aL2, $_aL1[$_P]) < 0		; not found 
      $_M = 1 + $_M				; increase array 
      ReDim Preserve $_aC2[$_M]
      $_aC2[$_M] = $_aL1[$_P]			; add missing item 
    EndIf
  Next
 
  $_M = -1
  For $_P = 0 to UBound($_aL2)
    If AScan($_aL1, $_aL2[$_P]) < 0		; not found 
      $_M = 1 + $_M				; increase array 
      ReDim Preserve $_aC1[$_M]
      $_aC1[$_M] = $_aL2[$_P]			; add missing item 
    EndIf
  Next
  
  $_aCompare[0] = $_aC1				; missing from L1 
  $_aCompare[1] = $_aC2				; missing from L2 
 
  $ListCompare = $_aCompare
 
  Exit 0
 
EndFunction