1. Home
  2. Computing & Technology
  3. Delphi Programming
GlossaryTips/Tricks|FREE App/VCL|Essentials|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

MatchesMask

unit
Masks
category
type conversion routines

declaration
function MatchesMask(const StringToMatch, Mask: string): Boolean;

description
Returns True is a string value matches a format specifed by a mask.

The function raises an exception if the Mask parameter is syntactically invalid. Syntactically valid Mask consists of literal characters, sets, and wildcards.
Wildcards are asterisks (*) or question marks (?). An asterisk matches any number of characters. A question mark matches a single arbitrary character.
The comparison to literal characters is NOT case-sensitive.

example
const s = 'http://delphi.about.com';

MatchesMask(s,'h?p://*') == FALSE
MatchesMask(s,'h??p://*') == TRUE
MatchesMask(s,'http://*') == TRUE
MatchesMask(s,'http://*.com') == TRUE
MatchesMask(s,'http://*.net') == FALSE
MatchesMask(s,'*.about.com') == TRUE
MatchesMask(s,'about.com*') == FALSE

in real code

see also
IntToStr, SetLength, StrToBool


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.