编程问题:如何在一个文本文件(如Txt)中,比较n行字符, 删除重复的字符串行,请见示例:
This is a test.
This is a test.
This is another test.
This is another test.
This is another test.
This is a test.
This is a test.
This is another test.删除其中重复的内容,变成:
This is a test.
This is another test.
This is a test.
This is a test.
This is another test.
This is another test.
This is another test.
This is a test.
This is a test.
This is another test.删除其中重复的内容,变成:
This is a test.
This is another test.
解决方案 »
- 一个双循环问题
- delphi中,pos找特殊字符 ’
- 各位帮帮忙:ADO连接数据库的问题??
- 如何在delphi窗体中操作已经画好的fastreport报表中bandview对象的属性?
- fsMDIChild子窗體不能關閉,只能最小化,請高手幫忙!!!
- 怎样反汇编成DELPHI代码?
- ClientDataset.Commandtext报' test:Execute not support:%s'在先等待!
- 问一个菜鸟问题
- 如何得到一个类的多个级联父类。例如:从Table1得到TTable、从TTable得到TDBDataSet依次类推!
- 是高手吗?
- ~~~久违的 ABC 控件~~~~
- Delphi中从Access数据库中取得时间的问题
var
sw:boolean;
i,cou:integer;
s:string;
fulltxt,newfulltxt:TStringList;begin
fullTxt := TStringList.Create;
newfulltxt := Tstringlist.Create;
fullTxt.LoadFromFile('abc.txt'); for i :=0 to fulltxt.Count-1 do
begin
sw:=false;
s:= fulltxt.Strings[i];
if i=0 then
begin
newfulltxt.Add(s);
Continue;
end; for cou := 0 to newfulltxt.Count-1 do
if AnsiSameStr(s,newfulltxt.Strings[cou]) then
sw := true; if not sw then
newfulltxt.Add(s); end;
newfulltxt.SaveToFile('abc.txt');
end;