Das ist nicht ausreichend, dann müssen die beiden Strings etwas umfangreicher verglichen werden, z.B. so...
Delphi-Quellcode:
function MatchStr(Source,Pattern:String;CaseSensitive:Boolean):Boolean;
function Match(Source,Pattern:PChar):Boolean;
begin
if StrComp(Pattern,'*')=0 then Result:=true
else
if (Source^=Chr(0)) and
(Pattern^<>Chr(0)) then Result:=false
else
if Source^=Chr(0) then Result:=true
else
case Pattern^ of
'*': if Match(Source,@Pattern[1]) then Result:=true
else Result:=Match(@Source[1],Pattern);
'?': Result:=Match(@Source[1],@Pattern[1]);
else if Source^=Pattern^ then Result:=Match(@Source[1],@Pattern[1])
else Result:=false;
end;
end;
begin
if not(CaseSensitive) then begin
Source :=AnsiLowerCase(Source);
Pattern:=AnsiLowerCase(Pattern);
end;
Result:=Match(PChar(Source),PChar(Pattern))
end;