Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

parsing a comma delimited string

5 views
Skip to first unread message

Vebjorn Ljosa

unread,
Nov 26, 2001, 6:32:54 PM11/26/01
to
* Myriam Abramson <mabr...@osf1.gmu.edu>
|
| Could somebody please show me how to loop through a comma-delimited
| string the right way.

With the help of SPLIT-SEQUENCE
(<URL:http://ww.telent.net/cliki/SPLIT-SEQUENCE>):

(split-sequence #\, "foo,bar ,baz, foobar , barbaz,")
=> ("foo" "bar " "baz" " foobar " " barbaz" "")

--
Vebjorn Ljosa

Erik Haugan

unread,
Nov 27, 2001, 4:37:54 AM11/27/01
to
* Myriam Abramson <mabr...@osf1.gmu.edu>
> Could somebody please show me how to loop through a comma-delimited
> string the right way.

As you would loop across any string:

(loop for char across string
...)

What are you trying to do?

Erik

Thomas F. Burdick

unread,
Nov 28, 2001, 3:42:02 AM11/28/01
to
Vebjorn Ljosa <ab...@ljosa.com> writes:

For what it's worth, I think this is a completely wrong way of doing
this. It conses unnecessarily, and can generally get in the way of
neat tricks. I use a utility to iterate through the string, and call
my code with the start and end of the substrings.

I posted my utilities to do this here:
http://groups.google.com/groups?q=group:comp.lang.lisp+splitting-vector&hl=en&rnum=1&selm=xcvvghhpw95.fsf%40conquest.OCF.Berkeley.EDU

(Note the messed up error message for call-splitting-vector, when
start < 0, oops)

--
/|_ .-----------------------.
,' .\ / | No to Imperialist war |
,--' _,' | Wage class war! |
/ / `-----------------------'
( -. |
| ) |
(`-. '--.)
`. )----'

0 new messages