* Daniel Pittman <dan...@rimspace.net>
What is the best, easiest, fastest, etc, way to split a string into substrings based on a character position.
(defun string-split (string &optional (delimiter #\Space))
(with-input-from-string (*standard-input* string)
(let ((*standard-output* (make-string-output-stream)))
(loop for char = (read-char nil nil nil)
if (or (null char)
(char= char delimiter))
collect (get-output-stream-string *standard-output*)
else
do (write-char char)
while char))))
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 59 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 22:38:28 |
| Calls: | 810 |
| Calls today: | 1 |
| Files: | 1,287 |
| D/L today: |
12 files (21,036K bytes) |
| Messages: | 195,759 |