delphi编程 定义数组类型老是出问题
unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,F...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
stringarray = array [0..27] of string; //***************************这行为什么显示出错?
function tiqu(s:string):stringarray;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.tiqu(s:string):stringarray;
var
nPos1,i,nPos2: Integer;
p: stringarray;
begin
for i:=0 to 27 do
begin
nPos1 := Pos('|', s);
delete(s,nPos1,1);
nPos2 :=Pos('|',s);
p[i]:=midstr(s,nPos1,nPos2-1);
delete(s,1,nPos2-nPos1);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
reP:stringarray;
i:integer;
begin
rep:=tiqu('123|asd|fd|as|sd||||||||||||||||||||||||||||||||||');
for i:=0 to 27 do
begin
memo1.Lines.Add(rep[i]);
end;
end;
end.
以上程序,运行出错,问题处在:stringarray = array [0..27] of string; 错误如下:
哪个高手能不能用delphi工具帮忙测试一下,会不会是我的delphi7.0软件有问题? 展开
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
stringarray = array [0..27] of string; //***************************这行为什么显示出错?
function tiqu(s:string):stringarray;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.tiqu(s:string):stringarray;
var
nPos1,i,nPos2: Integer;
p: stringarray;
begin
for i:=0 to 27 do
begin
nPos1 := Pos('|', s);
delete(s,nPos1,1);
nPos2 :=Pos('|',s);
p[i]:=midstr(s,nPos1,nPos2-1);
delete(s,1,nPos2-nPos1);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
reP:stringarray;
i:integer;
begin
rep:=tiqu('123|asd|fd|as|sd||||||||||||||||||||||||||||||||||');
for i:=0 to 27 do
begin
memo1.Lines.Add(rep[i]);
end;
end;
end.
以上程序,运行出错,问题处在:stringarray = array [0..27] of string; 错误如下:
哪个高手能不能用delphi工具帮忙测试一下,会不会是我的delphi7.0软件有问题? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询