how about this.
;;; convert a delimted string to a list
;;; arguments
;;; str = string "one,two,three"
;;; del = string delimiter ","
;;; example
;;; (setq a "one,two,three")
;;; (setq b (conv-del-str-lst a ","))
;;; ("one" "two" "three")
(defun conv-del-str-lst (str del / tmp lst nlst tlst)
;; add an extra 'del' to the end of the string
;; before proccessing
(setq tmp (substr str (strlen str) 1))
(if (/= tmp del)
(setq str (strcat str del))
)
;; convert string to list of ints
(setq lst (vl-string->list str)
del (ascii del); del to int
)
(foreach item lst
(cond ((/= item del)
(setq nlst (cons item nlst))
); cond 1
((= item del)
(setq tlst (cons (reverse nlst) tlst)
nlst nil
)
); cond 2
)
)
;; convert ints back to strings
(if tlst (mapcar 'vl-list->string (reverse tlst)))
)
;;; remove duplicates from a list
(defun remove-dups (lst / cntr nlst)
(setq cntr 0)
(while (< cntr (length lst))
(cond
((not (member (nth cntr lst) nlst))
(setq nlst (cons (nth cntr lst) nlst)
cntr (1+ cntr)
)
)
(T (setq cntr (1+ cntr)))
)
)
(if nlst (reverse nlst))
)
(setq a_str "gub:bub:sub:vub:dub:sub:cub:nub:sub:")
(setq a_lst (conv-del-str-lst a_str ":"))
-->("gub" "bub" "sub" "vub" "dub" "sub" "cub" "nub" "sub")
(setq final_list (remove-dups a_lst))
-->("gub" "bub" "sub" "vub" "dub" "cub" "nub")