Click to See Complete Forum and Search --> : Editing delimited text File - what's best - Split(), TextStreamObject or ADO
mazwinkel
July 30th, 2000, 11:20 AM
Hello - I would really appreciate some help with these two questions please..
when dealing with the editing of info in comma delimited files - is it better to
: use the Split function to read row info into an array
: use the textstreamobject
: use an ADO recordset
Other question
I want to use Line Input to begin reading from a file at the line which appears after a line containing a string, say "hello world" - is this possible?
Thanks,
Mairi
Lothar Haensler
July 31st, 2000, 01:47 AM
>is it better ...
what do you mean by "better"? faster? easier?
- split only splits a string into an array. You still have to read the line, either using Line input or the TextStreamObject.
I don't see any advantage in using the TextSTreamObject.
Ok, you can read the whole file into a string in one call (ReadAll). So what?! It doesn't take a lot more plain VB statements to do the same thing.
Using ADO for a text file will only bring you the additional overhead of ADO.
>I want to use Line Input to begin reading from a file at the line which appears after a line containing a string, say "hello world" - is this possible?
kind of.
Read the file until you find your match. Then, continue:
(pcode!)
line input #1, strLine
do while instr(strLine, "hello world") <= 0 AND eof(#1)=false
line input #1, strLine
Loop
' now start the "real" processing
Do while not eof(#1)
line input #1, strline
Loop
close #1
mazwinkel
July 31st, 2000, 06:39 AM
Thanks very much for responding Lothar and for the code to begin reading in a file at a certain point.
As for the differences between using SPLIT, ADO or TextStream object for editing CSV files - I suppose what I would like to know is what would be easier?
Each row in my CSV has 10 pieces of info.
Users can change the 4th and 9th bit on any row. The rest of the values in the row are used as for validation and resource ids. Ultimately I have to create a CSV with the user values.
At the moment I've duplicated the info in an Access Database - but this seems like overkill. From what you were saying a combination of LineInput and Split is more what I need?
Thanks again.
Mairi
Lothar Haensler
July 31st, 2000, 06:42 AM
I'd just like to throw in another option: use XML as data format for your values and use the MSXML parser to read, write and navigate your data.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.