1
13708782004
Unregistered / Unconfirmed
GUEST, unregistred user!
//这个例子来源Delphi_Super_Documents_2005_Kingron.rar
function CaseString(s: string
const x: array of string): integer;
var i: Integer;
s1, s2: string;
begin
Result := -1;
s1 := s;
AnsiUpperCase(s1);
for i := Low(x) to High(x) do begin
s2 := x;
AnsiUpperCase(s2);
if Pos(s1, s2) > 0 then begin Result := i
Exit
end;
//pos 是区分大小写的
// if s1 = s2 then begin Result := i
Exit
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if CaseString('float', ['float', 'numeric', 'Int', 'real', 'Smallint']) > -1 then showmessage('is num');
end;
这个代码执行了,为什么退出不彻底?
function CaseString(s: string
const x: array of string): integer;
var i: Integer;
s1, s2: string;
begin
Result := -1;
s1 := s;
AnsiUpperCase(s1);
for i := Low(x) to High(x) do begin
s2 := x;
AnsiUpperCase(s2);
if Pos(s1, s2) > 0 then begin Result := i
Exit
end;
//pos 是区分大小写的
// if s1 = s2 then begin Result := i
Exit
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if CaseString('float', ['float', 'numeric', 'Int', 'real', 'Smallint']) > -1 then showmessage('is num');
end;
这个代码执行了,为什么退出不彻底?