In article <·············@ro> ···@doe.carleton.ca (Dan D. He) writes:
Would someone out there know how to read a string with delimiter? What
I need is read a string like "abcd-efgh-ijk-lmn", I need to return
"abcd". The "-" is the delimiter.
e.g.
> (defparameter *my-readtable*
(let ((rt (copy-readtable nil)))
(set-syntax-from-char #\- #\space rt nil)
rt))
*MY-READTABLE*
> (let ((*readtable* *my-readtable*))
(with-input-from-string (*standard-input* (format nil "asdasd-asdp---aa-#'bjarne~%"))
(do ((tokens nil)
(token (read *standard-input* nil nil) (read *standard-input* nil nil)))
((not token) (nreverse tokens))
(push token tokens))))
(ASDASD ASDP AA (FUNCTION BJARNE))
>
--
Eyvind Ness, Research Scientist, OECD Halden Reactor Project, Norway.
~/.signature: No such file or directory ;-)