类似这样写: StripName: array[1..3, 1..5] of string; //假设为定议的数组 function IsLocate(aSTring:string):Boolean;//返回布尔值。 var I,J; begin result:=false; for I:=1 to 3 do begin for J:=1 to 4 do begin if aSTring=StripName[I,J] then //'你期望的值' result:=true;//找到了 exit; end; end; 在使用时可以这样: procedure button1.click(sender) begin if IsLocate(edit1.text) then showmessage('找到了'); end;
StripName: array[1..3, 1..5] of string; //假设为定议的数组
function IsLocate(aSTring:string):Boolean;//返回布尔值。
var
I,J;
begin
result:=false;
for I:=1 to 3 do
begin
for J:=1 to 4 do
begin
if aSTring=StripName[I,J] then //'你期望的值'
result:=true;//找到了
exit;
end;
end;
在使用时可以这样:
procedure button1.click(sender)
begin
if IsLocate(edit1.text) then
showmessage('找到了');
end;
来慢了,wangzh的方法不错啊。