the function:

function MatchesMask(const Filename, Mask: string): Boolean;

from the Masks unit already wraps this function. If you need more power then
go to www.torry.ru and search for Regular Expression components.

Cheers,
Stefan






----- Original Message ----- 
From: "Ross Levis" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Tuesday, July 01, 2003 5:26 PM
Subject: RE: [DUG]: Wildcard match of strings


Use the TMask object.  Here is a function I use.

function Matches(const S,Wildcard: String): Boolean;
var
  Mask: TMask;
begin
  Mask := TMask.Create(Wildcard);
  Result := Mask.Matches(S);
  Mask.Free;
end;

Eg. If Matches('I am Roger',*Roger*) then...

Ross Levis.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Allan, Samuel
> Sent: Tuesday, 1 July 2003 16:40
> To: Multiple recipients of list delphi
> Subject: [DUG]: Wildcard match of strings
>
>
> Does anyone know how to match two strings with wildcards?
>
> eg '*Roger*' = 'I am Roger'
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to