udfItemListReverse
str udfItemListReverse (str, str)
;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfItemListReverse (strItemList, strDelimiter)
strItemListReverse = ""
intCount = ItemCount (strItemList, strDelimiter)
For intElem = intCount To 1 By -1
   strItemListReverse = strItemListReverse : strDelimiter : ItemExtract (intElem, strItemList, strDelimiter)
Next
Return StrSub (strItemListReverse, 2, -1)
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------



;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfItemListReverse_2 (strItemList, strDelimiter)
strItemListReverse = ""
intCount = ItemCount (strItemList, strDelimiter)
For intElem = intCount To 1 By -1
   strItemListReverse = ItemInsert (ItemExtract (intElem, strItemList, strDelimiter), -1, strItemListReverse, strDelimiter)
Next
Return strItemListReverse
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------



;------------------------------------------------------------------------------------------------------------------------------------------
#DefineFunction udfItemListReverse_3 (strItemList, strDelimiter) ; Different algorithm than udfItemListReverse.
intCount = ItemCount (strItemList, strDelimiter) - 1
For intElem = intCount To 1 By -1
   strItemList = ItemRemove (intElem, ItemInsert (ItemExtract (intElem, strItemList, strDelimiter), -1, strItemList, strDelimiter), strDelimiter)
Next
Return strItemList
#EndFunction
;------------------------------------------------------------------------------------------------------------------------------------------


; Test.

strAlphaNumList = "9A,AAp,Bu,Ba7,Apm,Ba2s,Zi,Or,1A"
strReversedList1 = udfItemListReverse (strAlphaNumList, ",") ; "1A,Or,Zi,Ba2s,Apm,Ba7,Bu,AAp,9A"
strReversedList2 = udfItemListReverse_2 (strAlphaNumList, ",") ; "1A,Or,Zi,Ba2s,Apm,Ba7,Bu,AAp,9A"
strReversedList3 = udfItemListReverse_3 (strAlphaNumList, ",") ; "1A,Or,Zi,Ba2s,Apm,Ba7,Bu,AAp,9A"

:CANCEL
Exit