links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
CSV parsing
Last updated at 7:06 am UTC on 28 June 2016


As of 2016 use the following package


by Arvi Bryant

    location: 'http://www.squeaksource.com/CSV'
    user: '' 
    password: '

or directly work with findTokens:escapedBy: (CSV parsing).


Can anyone point to an up-to-date source for these methods?
Try: http://web.archive.org/web/*/http://nest.swiki.net/.uploads/String-csvSubstrings.st

Here are a couple of small methods to assist in working with CSV (Comma-Separated Values) files.

The first method is on String, and will take a CSV line and transform it into an ordered collection of substrings.

The second method is on SequenceableCollection (i.e., will work with OrderedCollection and Array) and will convert the objects in that collection into a CSV line.

Some code to read a CSV file:

|file rows|
rows _ OrderedCollection new.
file _ StandardFileStream fileNamed: 'someFileName.csv'.
file linesDo: [:line| rows addLast: line csvSubstrings].
rows inspect.

Chris Cunningham