VW code to read comma-delimited text files?? 
Author Message
 VW code to read comma-delimited text files??

Quote:

> Hello gang,

> Does anyone out there have any Smalltalk code to read in a
> comma-delimited text file?  What we're specifically doing is read in
> such a file that was created by Excel.

> Thanks,
> Gary

 Ive found the following method usefull:
!CharacterArray methodsFor: 'converting'!
unquotedCommaSeparatedValues
 "Answer an Array of tokens from comma separated values, some of which
may be enclosed within double-quotes (and hence, contain commas)."

 | tokens input nextToken |
 input := self readStream.
 tokens := Array new writeStream.
 [input atEnd] whileFalse: [
  (input peekFor: $") ifTrue: [
   nextToken := input upTo: $" .
   (input peekFor: $, ).
  ] ifFalse: [
   nextToken := input upTo: $, .
  ].
  tokens nextPut: nextToken.
 ].

 ^tokens contents
! !
-- Mike Klein

To programatically despam my email address, see:
http://www.*-*-*.com/ ~mklein/rot13ed.st
GO SMALLTALK -- GO VW2.5.2c



Wed, 18 Jun 1902 08:00:00 GMT  
 VW code to read comma-delimited text files??

Quote:

> Does anyone out there have any Smalltalk code to read in a
> comma-delimited text file?  What we're specifically doing is read in
> such a file that was created by Excel.

Gary, you may have a look at the KSC File Reader written by Bobby
Woolf. Although I haven't used it myself, from an outsider's point of
view it looks like a very powerful framework for reading text files.
Check it out at

        http://www.ksccary.com/filejrnl.htm

Hope this helps,
Kai

--



Wed, 18 Jun 1902 08:00:00 GMT  
 VW code to read comma-delimited text files??

Quote:

>Hello gang,
>Does anyone out there have any Smalltalk code to read in a
>comma-delimited text file?  What we're specifically doing is read in
>such a file that was created by Excel.  

 You may look at a system called FileReader, which can do the thing you
want - it's free and it was first introduced by an article in "The
Smalltalk Report".

 Marten



Wed, 18 Jun 1902 08:00:00 GMT  
 VW code to read comma-delimited text files??



Quote:

>>Hello gang,

>>Does anyone out there have any Smalltalk code to read in a
>>comma-delimited text file?  What we're specifically doing is read in
>>such a file that was created by Excel.  

> You may look at a system called FileReader, which can do the thing you
>want - it's free and it was first introduced by an article in "The
>Smalltalk Report".

> Marten

its available from ftp.ksccary.com


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Fortran 77: read second number on a line in a comma delimited text file

2. Import comma delimited text file

3. Reading a comma delimited file

4. Export Clarion .DAT files to ASCII comma delimited files

5. Export Clarion .DAT files to ASCII comma delimited files

6. getting fields NOT comma delimited with commas inside

7. AWK & Comma Delimited Text

8. Reading Comma delimited, Quoted String records

9. READ comma delimited data

10. Parsing Comma delimited files in J

11. matching records in a comma delimited file

12. Comma delimited file problem

 

 
Powered by phpBB® Forum Software