wuxiaoman 发表于 2019-6-11 12:46:21

delphi怎么删除richedit中的空行

例如:

form2.Top :=20; form2.Left :=500;

form2.Left :=500; form2.Left :=500;

form2.Top :=20; form2.Left :=500;

form2.Left :=500; form2.Left :=500;

删除后让richedit中=
form2.Top :=20; form2.Left :=500;
form2.Left :=500; form2.Left :=500;
form2.Top :=20; form2.Left :=500;
form2.Left :=500; form2.Left :=500;

冬雪雪冬 发表于 2019-6-11 21:04:04

procedure TForm1.Button1Click(Sender: TObject);
var
str: string;
begin
str := stringReplace(RichEdit1.text, #13#10#13#10, #13#10, ) ;
RichEdit1.Text := str;
end;

end.

wuxiaoman 发表于 2019-6-13 17:02:55

冬雪雪冬 发表于 2019-6-11 21:04


谢谢,你这样只能删除一个空行,多个空行不行,我已经解决了
var i:integer;
for i := (RichEdit1.Lines.Count - 1) downto 0 do
begin
   if RichEdit1.Lines = '' then RichEdit1.Lines.Delete(i);

end;

冬雪雪冬 发表于 2019-6-15 19:35:20

wuxiaoman 发表于 2019-6-13 17:02
谢谢,你这样只能删除一个空行,多个空行不行,我已经解决了
var i:integer;
for i := (RichEdit1.Li ...

这个办法好
页: [1]
查看完整版本: delphi怎么删除richedit中的空行