S
SP229
Unregistered / Unconfirmed
GUEST, unregistred user!
有一个数组:const ss: array[0..11] of string=('A','B','C','D','E','F','G','H','I','J','K','L');想给一个动态数组赋值,在一个EDIT中输入比如“F”,求出F在数组SS中的位置,那么这个动态数组AA就从F开始,['F','G','H','I','J','K','L','A','B','C','D','E']输入“G”那么就从G开始:AA=['G','H','I','J','K','L','A','B','C','D','E','F],现在我写了一段代码,有些可以 ,有些不行,请大家帮我看看。procedure TForm1.btn3Click(Sender: TObject);const ss: array[0..11] of string=('A','B','C','D','E','F','G','H','I','J','K','L');var i,J: Integer; n: Integer;begin mmo1.Clear; n:=AnsiIndexText(Edit1.Text,ss); Edit3.Text :=IntToStr; SetLength(AA,High(SS)); for i:=0 to 11 do begin if i<n then J:=I+(High(SS)-N) else J:=I-N; AA:=SS[J]; mmo1.Lines.Add(SS[J]) end;end;