|
-
Aug 7th, 2007, 09:41 AM
#1
Thread Starter
New Member
[2005] Remove hex 1A character from txt file??
Hello,
I have a text file with a character (hex 1A) that I would like to remove. I'm having troubles writing a script to do this. I'm new to VB and any help would be greatly appreciated.
Thanks!
-
Aug 7th, 2007, 09:54 AM
#2
Re: [2005] Remove hex 1A character from txt file??
Something like the following will remove all 0x1A characters from the file.
VB.NET Code:
Using f As FileStream = File.OpenRead("path\file")
Using sr As New StreamReader(f)
Dim text As String = sr.ReadToEnd()
text = text.Replace(CChar(&H1A), String.Empty)
End Using
End Using
-
Aug 7th, 2007, 10:18 AM
#3
Thread Starter
New Member
Re: [2005] Remove hex 1A character from txt file??
-
Aug 7th, 2007, 10:27 AM
#4
Re: [2005] Remove hex 1A character from txt file??
Sorry, I forgot all about actually writing to the file. 
Here's some more sensible code.
VB.NET Code:
Dim text As String
Using sr As New StreamReader("path\to\file")
text = sr.ReadToEnd()
text = text.Replace(CChar(&H1A).ToString(), String.Empty)
End Using
Using sw As New StreamWriter("path\to\file")
sw.Write(text)
End Using
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|