;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       ListTrim() 
;; 
;;ACTION         Trims the trailing delimiter from a delimited list 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0  - 2020/07/29 
;; 
;;HISTORY        1.0  - 2020/07/29 - Initial Release 
;; 
;;SYNTAX         ListTrim(List, Delimiter) 
;; 
;;PARAMETERS     List - REQUIRED - a delimited list string 
;;               Delimiter - REQUIRED - the delimiter character 
;; 
;;REMARKS        Trims any trailing delimiter (empty field) from a delimited list 
;; 
;;RETURNS        String - list with any trailing delimeter removed 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K16, W2K19, W10 
;; 
;;EXAMPLES       $List = $List + ',' + $Item	; if $Item is blank, list will end with a delimiter 
;;               $List = ListTrim($List, ',') 
; 
Function ListTrim($_List, $_Delimiter)
 
  If Right($_List, 1) = $_Delimiter
    $ListTrim = Left($_List, Len($_List) - 1)
  Else
    $ListTrim = $_List
  EndIf
 
  Exit 0
 
EndFunction