Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.IO
- Imports System.Text
- Module Module1
- Sub Main()
- Dim args() As String = My.Application.CommandLineArgs.ToArray
- For Each arg As String In args
- If arg.ToLower.EndsWith(".txt") Then
- Dim meh As New StringBuilder()
- Using sr As New StreamReader(arg)
- While sr.Peek <> -1
- meh.AppendLine(Formatter(sr.ReadLine))
- End While
- End Using
- IO.File.WriteAllText(arg.Replace(".txt", "_Formatted.txt"), meh.ToString)
- End If
- Next
- End Sub
- Private Function Formatter(ByVal line As String) As String
- If line.StartsWith(">") Then
- Dim parts() As String = line.Split(New String() {" "}, StringSplitOptions.RemoveEmptyEntries)
- If parts(0).StartsWith(">") Then parts(0) = parts(0).Substring(1)
- Return "> " & parts(1) & " " & parts(2) & " " & parts(0)
- End If
- Return line
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment