出来了!
procedure MySort(Var ListResult:TStringList);
var
i,i1,i2,i3,i4,i5,i6:SHORT;
TempStr,ResultStr,Sample1,Sample2,Sample3,Sample4,Sample5,Sample6,Sample7:string;
Const
Sample='ABCDEFG';
begin
ListResult.Clear;
SetLength(TempStr,7);
Sample1:=Sample;
for i1:= 1 to 7 do
begin
TempStr[1]:=Sample1[i1];
Sample2:=copy(Sample1,1,pos(TempStr[1],Sample1)-1)+copy(Sample1,pos(TempStr[1],Sample1)+1,255);
for i2:= 1 to 6 do
begin
TempStr[2]:=Sample2[i2];
Sample3:=copy(Sample2,1,pos(TempStr[2],Sample2)-1)+copy(Sample2,pos(TempStr[2],Sample2)+1,255);
for i3:= 1 to 5 do
begin
TempStr[3]:=Sample3[i3];
Sample4:=copy(Sample3,1,pos(TempStr[3],Sample3)-1)+copy(Sample3,pos(TempStr[3],Sample3)+1,255);
for i4:= 1 to 4 do
begin
TempStr[4]:=Sample4[i4];
Sample5:=copy(Sample4,1,pos(TempStr[4],Sample4)-1)+copy(Sample4,pos(TempStr[4],Sample4)+1,255);
for i5:= 1 to 3 do
begin
TempStr[5]:=Sample5[i5];
Sample6:=copy(Sample5,1,pos(TempStr[5],Sample5)-1)+copy(Sample5,pos(TempStr[5],Sample5)+1,255);
for i6:= 1 to 2 do
begin
TempStr[6]:=Sample6[i6];
Sample7:=copy(Sample6,1,pos(TempStr[6],Sample6)-1)+copy(Sample6,pos(TempStr[6],Sample6)+1,255);
TempStr[7]:=Sample7[1];
ListResult.Add(TempStr);
end;
end;
end;
end;
end;
end;
end;
//调用方法
procedure TForm1.Button1Click(Sender: TObject);
var
MyList:TStringList;
begin
MyList:=TStringList.Create;
try
MySort(MyList);
MyList.SaveToFile('d:/Test.txt');
finally
MyList.Free;
end;
end;