Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 681

Find/Replace all intances of "," in .txt file

$
0
0
hi everyone, i would like to ask for your expert opinions regarding my problem with .txt file.

i have this data:

"00000000","000","01 123 123456","5000000000000012345678","00000123456","","","","","31-MAR-2014","","",""
"00000000","000","01 123 123456","5000000000000012345678","00000123456","","","","","31-MAR-2014","","",""
"00000000","000","01 123 123456","5000000000000012345678","00000123456","","","","","31-MAR-2014","","",""
"00000000","000","01 123 123456","5000000000000012345678","00000123456","","","","","31-MAR-2014","","",""
"00000000","000","01 123 123456","5000000000000012345678","00000123456","","","","","31-MAR-2014","","",""
"00000000","000","01 123 123456","5000000000000012345678","00000123456","","","","","31-MAR-2014","","",""
"00000000","000","01 123 123456","5000000000000012345678","00000123456","","","","","31-MAR-2014","","",""

and using this code:

Const ForReading = 1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("d:\script\sample.txt", ForReading)

strText = objFile.ReadAll
one = ","
two = " "
objFile.Close
strNewText = Replace(strText, one, two)

Set objFile = objFSO.OpenTextFile("d:\script\sample.txt", ForWriting)
objFile.WriteLine strNewText
objFile.Close


my purpose of this is to replace all "," with spaces, but i have a problem because when i use one = "","" it will return an error and when i use one = "," it only replaces , not the ",".

thank you in advance for your help.

Viewing all articles
Browse latest Browse all 681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>