Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Remove a character from a text file


'first read text file into string
Dim InString As String
Open "filename.txt" For Binary As #1
InString   = Input (LOF(1), #1)
Close

'then replace specified character(s) with an empty string ""
InString = Replace(Instring, CharToRemove, "" )

'finally put string back into the file
Open "filename.txt" For Output As #1
Put #1, InString
Close