QB64 Phoenix Edition
Blank Line Remover - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Utilities (https://staging.qb64phoenix.com/forumdisplay.php?fid=8)
+---- Thread: Blank Line Remover (/showthread.php?tid=1442)



Blank Line Remover - bplus - 02-04-2023

Quick little code for Windows .bas code that got double spaced at a forum:
Code: (Select All)
_Title "Blank Line Remover" ' b+ 2023-02-04

FixMe$ = _OpenFileDialog$("Select .bas file to remove blank lines from", _CWD$, "*.bas", "Basic files")
t$ = Mid$(FixMe$, 1, _InStrRev(FixMe$, "\")) + "temp.bas"
cancel& = _MessageBox("Check Names", "Fix file: " + FixMe$ + Chr$(10) + "Temp: " + t$, "okcancel", "question")
If cancel& = 1 Then
    Open FixMe$ For Input As #1
    Open t$ For Output As #2
    While EOF(1) = 0
        Line Input #1, fline$
        If _Trim$(fline$) <> "" Then Print #2, fline$
    Wend
    Close
    Kill FixMe$
    Name t$ As FixMe$
    Print "File converted."
End If