I am trying to read and process the contents of a csv file in smalltalk (visualworks), but it seems to me not easy to get a string to be split into an array. Below is the code I managed to get. I miss the part that breaks the contents of the myLine variable, which is a comma-delimited string, into an array of strings to be added to TwoDList. Please help with any information you may have about how to approach this, please. thanks
SpreadsheetReadCSV: inFilename |inStream myLine rcnt| rcnt := 0. " scan thru the text lines, using a traditional i/o loop " inStream := (inFilename asFilename) readStream . [ inStream atEnd ] whileFalse: [ rcnt := rcnt + 1. myLine := inStream upTo: Character cr. "Process the commadelimited string here" ]. inStream inspect. inStream close. ^myLine.
source share