Hi,
I have a very large file where i want to delete all quotation marks before and after a comma,
What is the fast way to do that?
Thanks,
Sue
Printable View
Hi,
I have a very large file where i want to delete all quotation marks before and after a comma,
What is the fast way to do that?
Thanks,
Sue
Dim strFileName as string
Dim strHuge as string
Dim ln as Long
Dim strFileContent() as string
Dim iFile as Integer
iFile = FreeFile
strFileName = "path\to\your\file.ext"
Open strFileName for input as #iFile
ln = FileLen(strFileName)
strHuge = Space(ln)
strHuge = input(ln, iFile)
Close #iFile
strHuge = Replace(strHuge, "," & chr(34), "")
strHuge = Replace(strHuge, chr(34) & ",", "")
iFile = FreeFile
Open strFileName for output as #iFile
print #iFile, strHuge
Close #iFile
--Some code thanks to sharathms--
-K
i am using vb5, is Replace function available in vb5?
Replace is not available in VB5
Iouri Boutchkine
[email protected]
Well since replace isn't in VB5 then I will give you similar code using the InStr function. I hope that function is in VB5.
Dim strFileName as string
Dim strHuge as string
Dim ln as Long
Dim strFileContent() as string
Dim iFile as Integer
Dim lPos as Long
iFile = FreeFile
strFileName = "path\to\your\file.ext"
Open strFileName for input as #iFile
ln = FileLen(strFileName)
strHuge = Space(ln)
strHuge = input(ln, iFile)
Close #iFile
lPos = InStr(strHuge, "," & chr(34))
while lPos <> 0
strHuge = Left(strHuge, lPos - 1) & mid(strHuge, lPos + 2)
lPos = InStr(strHuge, "," & chr(34))
wend
lPos = InStr(strHuge, chr(34) & ",")
while lPos <> 0
strHuge = Left(strHuge, lPos - 1) & mid(strHuge, lPos + 2)
lPos = InStr(strHuge, chr(34) & ",")
wend
iFile = FreeFile
Open strFileName for output as #iFile
print #iFile, strHugeClose #iFile
--Some code thanks to sharathms--
-K