Try the following and see if it will work for you.
Terry
Code:
;-------------------------------------------------------------------------------
; WordList - Returns a list of words in a sentence
; Arguments: 1
; Sentence$ = String to convert into a list strings
; Syntax: (WordList "Words in a sentence") = (list "Words" "in" "a" "sentence")
; Returns: List of words or strings that were seperated by spaces in a sentence
;-------------------------------------------------------------------------------
(defun WordList (Sentence$ / Cnt# Item$ Mid$ Num# ReturnList@)
(setq Cnt# 1 Num# 1)
(repeat (strlen Sentence$)
(setq Mid$ (substr Sentence$ Cnt# 1))
(if (= Mid$ " ")
(progn
(setq Item$ (substr Sentence$ Num# (- Cnt# Num#)))
(if (/= Item$ "")
(setq ReturnList@ (append ReturnList@ (list Item$)))
);if
(setq Num# (1+ Cnt#))
);progn
);if
(setq Cnt# (1+ Cnt#))
);repeat
(if (not ReturnList@)
(setq ReturnList@ (list Sentence$))
(if (/= (substr Sentence$ Num#) "")
(setq ReturnList@ (append ReturnList@ (list (substr Sentence$ Num#))))
);if
);if
ReturnList@
);defun WordList