I've attached a small console application that will do what you want. Pass
the filename as the only parameter. It opens the files and reads in line by
line looking for groups of 4 blank lines. I tried the code on a sample inout
file (included in the zip) but you should clean up the code.
AssignFile(SF, FSource);
Reset(SF);
try
AssignFile(DF, FDest);
ReWrite(DF);
try
Level := 0;
while not eof(SF) do
begin
ReadLn(SF, s);
if s = '' then
begin
Inc(Level);
if Level = 4 then
Level := 0;
end
else
begin
if Level <> 0 then
for I := 0 to Level-1 do // Iterate
WriteLn(DF, '');
Level := 0;
WriteLn(DF, s);
end;
end; // while
finally
CloseFile(DF);
end;
finally
CloseFile(SF);
end;
{ TODO -oUser -cConsole Main : Insert code here }
end.
Thanks,
Scott
Children are all foreigners. - Ralph Waldo Emerson
__________________________________________
SoftSystem Solutions, LLC
18 Ridge Road
Clark, New Jersey 07066 USA
Scott Kellish, Owner
Tel. +01 732 382 1873
Fax: +01 732 382 1873
Mobile: +01 732 261-5856
e-mail: [EMAIL PROTECTED]
__________________________________________
----- Original Message -----
From: "Eddie Shipman" <[EMAIL PROTECTED]>
To: "Borland's Delphi Discussion List" <[email protected]>
Sent: Tuesday, March 21, 2006 9:21 AM
Subject: Re: Formatting Text Files
> You can load them indivudually into a stringlist and remove the empty
> lines by looping through backwards and checking the line length.
>
> <SNIP>
>> So what I am asking is what is a easy way to detect 4 x CR LF in a row
>> and skip appending these to my memo.
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
>
CONFIDENTIALITY NOTICE: The information in this message is confidential and
may be legally privileged. It is intended solely for the addressee. Access
to this message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, or distribution of this message, or any
action or omission taken by you in reliance on it, is prohibited and may be
unlawful. Please immediately contact the sender if you have received this
message in error and permanently delete this message and any attachments.
Thank you.
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi