Public Function deleteNumbers(ByVal Input As String) as string
Dim lines() As String = System.Text.RegularExpressions.Regex.Split(Input, "\n")
Dim sB As New System.Text.StringBuilder
For i = 0 To lines.count - 1
Dim split As String = lines(i).split(".")(0)
Dim line As String = lines(i).substring(split.Length + 2, lines(i).length - split.Length - 2)
sB.AppendLine(line)
Next
Return sB.ToString
End Function
using sR as new system****.streamreader("yourfile.txt")
dim newText as string = deleteNumbers(sR.readtoend)
using sW as new system****.streamwriter("updated.txt")
sW.write(newText)
end using
end using
Public Function delNumbers(ByVal Input As String)
Return System.Text.RegularExpressions.Regex.Replace(Input, "\d+. ", "")
End Function
Imports System.[IO]
Dim Opn As New OpenFileDialog
If Opn.ShowDialog = DialogResult.OK Then
Dim SR As New StreamReader(Opn.FileName)
Dim tmp As String = SR.ReadToEnd
Dim tmpPath As String = Path.GetTempFileName
Dim SW As New StreamWriter(tmpPath)
SR.Close()
Dim i As Integer = 0, j = tmp.Length, _End
Do
i = tmp.IndexOf("www", i)
If i <> -1 Then
_End = tmp.Substring(i, If((j - i > 30), 30, j - i)).IndexOf(ChrW(10))
If _End <> -1 Then
SW.WriteLine(tmp.Substring(i, _End))
End If
i += 1
End If
Loop Until i = -1
SW.Close()
File.Delete(Opn.FileName)
File.Move(tmpPath, Opn.FileName)
MessageBox.Show("DONE")
End If
Public Shared Sub FormatFile(ByVal inputFile As String, ByVal outputFile As String)
Using sReader As New IO.StreamReader(inputFile)
Using sWriter As New IO.StreamWriter(outputFile)
Dim line As String = String.Empty
Dim sections As String()
While Not sReader.EndOfStream
line = sReader.ReadLine()
sections = line.Split(New Char() {" "c}, 2)
sWriter.WriteLine(CType(If(sections.Length = 2, sections(1), sections(0)), String))
End While
End Using
End Using
End Function
FormatFile("B:\fuckedformatting.txt", "B:\niceformatting.txt")
Dim original As String() = IO.File.ReadAllLines("yourfile")
IO.File.WriteAllLines("yourfile", Array.ConvertAll(original, Function(s) s.Split(New Char() { " "c }, 2)(1)))
Private Shared Function ExtractSitesFromFile(Filename As String) As List(Of String) Dim TempList As New List(Of String)() Dim Data As String = System.I O.File.ReadAllText(Filename) For Each NextURL As Match In Regex.Matches(Data, "(?<=.*?)www.*") TempList.Add(NextURL.Value) Next Return TempList End Function Private Shared Function ExtractSitesFromText(Source As String) As List(Of String) Dim TempList As New List(Of String)() For Each NextURL As Match In Regex.Matches(Source, "(?<=.*?)www.*") TempList.Add(NextURL.Value) Next Return TempList End Function
For Each Line As String In ExtractSitesFromFile(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\Data.txt") 'MsgBox(Line) -- Display the line. Next