//Delphi 下的通配符查找函数
Function IsLike(ax, abc: String): Boolean; Var
abcstart, axstart, abclength, axlength: Integer;
endpartabc, endpartax, subax: String;
temp, abcwww, axwww: Integer;
Begin temp := 0;
abcstart := 1;
axstart := 1;
axwww := 1;
abcwww := 1;
ax:=LowerCase(ax);
abc:=LowerCase(abc);
abclength := Length(abc);
axlength := Length(ax);
result := True;
While axstart <= axlength Do Begin If ax[axstart] = '?' Then Begin
inc(axstart);
inc(abcstart);
If abcstart > abclength+1 Then Begin
result := false;
Break;
End;
Continue;
End;
If ax[axstart] = '*' Then Begin
inc(axstart);
temp := 1;
axwww := axstart;
abcwww := abcstart;
Continue;
End;
If Not (ax[axstart] In ['?', '*']) Then Begin endpartax := Copy(ax, axstart, axlength - axstart + 1) + '?*';
If Pos('?', endpartax) < Pos('*', endpartax) Then Begin
subax := Copy(endpartax, 1, Pos('?', endpartax) - 1);
axstart := axstart + Pos('?', endpartax) - 1;
End
Else Begin
subax := Copy(endpartax, 1, Pos('*', endpartax) - 1);
axstart := axstart + Pos('*', endpartax) - 1;
End;
endpartabc := Copy(abc, abcstart, abclength - abcstart + 1);
If ((Pos(subax, endpartabc) <> 0) And (temp = 1)) Or ((Pos(subax, endpartabc) = 1) And (temp = 0)) Then Begin If temp = 1 Then temp := 0;
abcstart := abcstart + (Pos(subax, endpartabc) + Length(subax) - 1);
End
Else Begin If temp = 0 Then Begin
axstart := axwww;
abcwww := abcwww + 1;
abcstart := abcwww;
temp := 1;
Continue;
End;
result := false;
Break;
End; End; End; End;