
Stripping of unwanted data from text file
I've found my solution and would like to share out:
Open OriginalTextFile as Input for #1
Open ModifiedTextFile as Output for #2
Do While Not (EOF(1))
Input #1 StringVar1, StringVar2, StraingVar3, StringVar4, IntVar1,
IntVar2, IntVar3
Print #2 StringVar1, StringVar2, StringVar3, StringVar4, IntVar1,
IntVar2, IntVar3
Loop
Close #1
Close #2
This way, with OriginalTextFile contents of:
"StringVar1","StringVar2","StringVar3","StringVar4",IntVar1,IntVar2,IntVar3
"ABC","DEF","GHI","JKL",123,234,345
will become ModifiedTextFile of:
StringVar1 StringVar2 StringVar3 StringVar4 IntVar1 IntVar2 IntVar3
ABC DEF GHI JKL 123 234 345
ST
Quote:
> Instead of creating an all new file what you can do is test each string
> before using it to make sure there are no apostrophes.
> If InStr(strName, "'") > 0 Then
> For Count = 1 To Len(strName)
> Char = Mid(strName, Count, 1)
> If Char = "'" Then
> Buffer = Buffer
> Else
> Buffer = Buffer & Char
> End If
> Next
> (function) = Buffer
> It is mighty slow, though.
> Charles Carroll
> --
> Desert Sea Publishing Co. http://www.desertsea.com
> 112 Hope Farm Road Horse Racing Books
> Socorro, New Mexico 87801 Software, and Videos
> > I have a text file with quotation marks and commas which I would like to
> > delete. I intend to create a routine/procedure with VB to input this
> file,
> > parse the file - copying exactly all contents except the quotation marks
> and
> > commas, and writing the results to another text file. How can I do
that?
> > Or where can I find guides/links for me to achieve that? What driver
> should
> > I use?
> > Thanks,
> > ST