how can i search a .txt file for three stars ***
if found delete them
Printable View
how can i search a .txt file for three stars ***
if found delete them
open the file into a string
VB Code:
mystr = Replace(mystr, "***", "") 'replace 3 stars together with nothing
open file for output and print string to file
VB Code:
Dim tmp As String Dim ff As Integer 'read it... ff = FreeFile Open "c:\test.txt" For Input As #ff tmp = Input(LOF(ff), ff) Close #ff 'replace *** with vbNullString... tmp = Replace(tmp, "***", vbNullString) 'write it back... ff = FreeFile Open "c:\test.txt" For Output As #ff Print #ff, tmp; Close #ff