Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub ReplaceText(ByVal FileName As String, ByVal StartStr As String, ByVal ReplaceWith As String)
- Dim l As String = ""
- Dim full As String = ""
- If IO.File.Exists(FileName) Then
- Using sRead As New IO.StreamReader(FileName)
- While Not sRead.EndOfStream
- l = sRead.ReadLine
- If l.Trim.ToLower.Contains(StartStr.Trim.ToLower) Then
- l = l.Replace(l, ReplaceWith)
- End If
- full &= l & vbNewLine
- End While
- End Using
- Using sWrite As New IO.StreamWriter(FileName, False)
- sWrite.Write(full)
- End Using
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement