Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
function MatchesMask(const StringToMatch, Mask: string): Boolean;
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.
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
|
IntToStr, SetLength, StrToBool
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|