procedure TForm1.Button1Click(Sender: TObject); var s: string; begin with TStringList.Create do try LoadFromFile('Your Text File Name'); s := Text; while pos(#13, s) > 0 do System.Delete(s, pos(#13, s), 1); while pos(#10, s) > 0 do System.Delete(s, pos(#13, s), 1); Text := s; SaveToFile('Your Text File Name'); finally Free; end; end;
procedure TForm1.Button1Click(Sender: TObject); begin form1.Memo2.text:=(StringReplace(form1.Memo1.text,#13#10,'',[rfReplaceAll])); end;
#13#10把TXT内容全部都读出来,然后作一行输出到TXT中啊。
var
s: string;
begin
with TStringList.Create do
try
LoadFromFile('Your Text File Name');
s := Text;
while pos(#13, s) > 0 do
System.Delete(s, pos(#13, s), 1);
while pos(#10, s) > 0 do
System.Delete(s, pos(#13, s), 1);
Text := s;
SaveToFile('Your Text File Name');
finally
Free;
end;
end;
begin
form1.Memo2.text:=(StringReplace(form1.Memo1.text,#13#10,'',[rfReplaceAll]));
end;
memo1.Text:=StringReplace(Memo1.Text,#$0D#$0A,'',[rtReplaceAll]);
memo1.SaveToFile(...);
memo1.Text:=StringReplace(Memo1.Text,#$0D#$0A,'',[rfReplaceAll]);
memo1.SaveToFile(..);