udfItemListTrim
udfItemListTrimDup
str udfItemListTrim (str, str)
str udfItemListTrimDup (str, str)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfItemListTrim (strItemList, strDelimiter)
strTrimList = ""
intCount = ItemCount (strItemList, strDelimiter)
For intElem = 1 To intCount
   strItem = ItemExtract (intElem, strItemList, strDelimiter)
   If strItem != "" Then strTrimList = ItemInsert (strItem, -1, strTrimList, strDelimiter)
Next
Return strTrimList
...........................................................................................................................................
; This UDF udfItemListTrim returns an itemlist with empty items removed.
...........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfItemListTrimDup (strItemList, strDelimiter)
strTrimList = ""
intCount = ItemCount (strItemList, strDelimiter)
For intElem = 1 To intCount
   strItem = ItemExtract (intElem, strItemList, strDelimiter)
   If strItem != "" Then If !ItemLocate (strItem, strTrimList, strDelimiter) Then strTrimList = ItemInsert (strItem, -1, strTrimList, strDelimiter)
Next
Return strTrimList
...........................................................................................................................................
; This UDF udfItemListTrimDup returns an itemlist with empty items removed and duplicates removed.
...........................................................................................................................................
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strAlphaNumList = "9A,,AAp,Bu,,,,Bu,Apm,Bu,Ba2s,,Zi,Zi,Or,1A," ;  17 items = 6 empty, 1+2 same, 1+1 same, 8 unique.
strTrimmedList1 = udfItemListTrim (strAlphaNumList, ",")       ; "9A,AAp,Bu,Bu,Apm,Bu,Ba2s,Zi,Zi,Or,1A" ==> 11 items.
strTrimmedList2 = udfItemListTrimDup (strAlphaNumList, ",")    ; "9A,AAp,Bu,Apm,Ba2s,Zi,Or,1A" ==> 8 items.

Exit