var i: Integer; s: string; begin for I := 0 to mmo1.Lines.Count - 1 do begin s := mmo1.Lines[i]; mmo1.Lines.Delete(i); while mmo1.Lines.IndexOf(s) > -1 do mmo1.Lines.Delete(mmo1.Lines.IndexOf(s)); mmo1.Lines.Insert(i, s); end; end;
结果:
var i: Integer; s: string; begin for I := 0 to mmo1.Lines.Count - 1 do begin s := mmo1.Lines[i]; mmo1.Lines.Delete(i); while mmo1.Lines.IndexOf(s) > -1 do mmo1.Lines.Delete(mmo1.Lines.IndexOf(s)); mmo1.Lines.Insert(i, s); end; end;
结果: