parsing a comma delimited string 
Author Message
 parsing a comma delimited string


|
| Could somebody please show me how to loop through a comma-delimited
| string the right way.

With the help of SPLIT-SEQUENCE
(<URL: http://www.*-*-*.com/ ;):

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

--
Vebjorn Ljosa



Sat, 15 May 2004 07:32:54 GMT  
 parsing a comma delimited string

Quote:
> 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



Sat, 15 May 2004 17:37:54 GMT  
 parsing a comma delimited string

Quote:


> |
> | 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" "")

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-vect...

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

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



Sun, 16 May 2004 16:42:02 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Question: How can I Parse a comma delimited string.

2. Parsing Comma delimited files in J

3. Parsing Comma Delimited Data

4. newbie needs a little help parsing a comma delimited file

5. getting fields NOT comma delimited with commas inside

6. Reading Comma delimited, Quoted String records

7. Parsing a CSV file containing quoted strings (themselves containing commas)

8. Convert comma-delimited records to fixed length records

9. matching records in a comma delimited file

10. comma delimited

11. Comma delimited file problem

12. AWK & Comma Delimited Text

 

 
Powered by phpBB® Forum Software