;;; ;;; Splits a string into tokens delimited by a set of characters ;;; specified by another string. ;;; ;;; Dan Cross ;;; (defun split-on (delims string) "Split the string 'string' on any of the characters in 'delims' and return the results. Ignores empty fields." (labels ((isdelim (c) (position c delims)) (span-delims (string start) (when (and string start) (position-if-not #'isdelim string :start start))) (span-not-delims (string start) (when (and string start) (position-if #'isdelim string :start start)))) (loop for b = (span-delims string 0) then (span-delims string (1+ f)) as f = (span-not-delims string b) when b collect (subseq string b f) while f)))