Script Name: RemoveLnFile
Script Description: The script removes the specified line (first line is 0!) from the specified file.
Original Author(s): Railor
Core Version: 2.6.3
Code:procedure RemoveLnFile(File: string; Line: integer);
var
splitted_file: TStringArray;
i: integer;
begin
if FileExists(File) then
begin
splitted_file := xsplit(ReadFile(File),chr(13)+chr(10));
if Line <= ArrayHigh(splitted_file) then
begin
WriteFile(File,'');
for i := 0 to Line-1 do
if splitted_file[i] <> '' then
WriteLnFile(File,splitted_file[i]);
for i := Line+1 to ArrayHigh(splitted_file) do
if splitted_file[i] <> '' then
WriteLnFile(File,splitted_file[i]);
end
end
end;