[Newbies] CSV file help

Ron Teitelbaum ron at usmedrec.com
Fri Jun 17 21:24:45 UTC 2016


Hi Joe,

I haven't tried it but I would probably start with Avi's CSV Parser
http://www.squeaksource.com/CSV.html

But in general you want to parse all of your lines, then for each line parse quoted values, then you can parse commas.

All the best,

Ron Teitelbaum

> -----Original Message-----
> From: beginners-bounces at lists.squeakfoundation.org [mailto:beginners-
> bounces at lists.squeakfoundation.org] On Behalf Of Joseph Alotta
> Sent: Friday, June 17, 2016 4:42 PM
> To: beginners at lists.squeakfoundation.org
> Subject: [Newbies] CSV file help
> 
> Greetings,
> 
> I am needing conceptual help with parsing these troublesome CSV files.  I
> was breaking the lines using String >> findToken:
> but I found lines where extra deliminators were added.  Notice the three
> following lines, the first and third line have extra commas from Oak Brook, IL
> and the second line does not have the comma.
> 
> 
> 02/04/2016  Thu,,"COSTCO WHSE #0388 000000000990388 - OAK BROOK,
> IL",,,,,37.00,,,,,,,,
> 02/05/2016  Fri,,"ELECTRONIC PAYMENT RECEIVED-THANK",,,,,-443.52,,,,,,,,
> 02/06/2016  Sat,,"COSTCO WHSE #1088 000000000991088 - BOLINGBROOK,
> IL",,,,,50.86,,,,,,,,
> 
> I think I need to parse with the double quotes in mind, but I don’t know
> where to break it.
> 
> Also, I was reading in the squeak pages that someone had already written
> code for this, but I couldn’t find anything.
> 
> http://wiki.squeak.org/squeak/3260 has two methods, CSVSubstrings and
> SequenceableCollection-asCSVLine.st
> 
> Does anyone know where these are now?
> 
> Sincerely,
> 
> Joe.
> 
> 
> 
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners



More information about the Beginners mailing list