Sign in Join
FPDoc Onlineexperiment

MatchesMaskList function

In unit Masks

Determine whether the specified file name matches at least one of the specified masks.

Declaration

pascal
function MatchesMaskList(const FileName: string; const Mask: string; 
                        Separator: char=';'; 
                        CaseSensitive: Boolean=False; 
                        aOpcodesAllowed: TMaskOpCodes=DefaultMaskOpCodes)
                         : Boolean

Arguments

FileName

File name compared to the file masks in Mask.

Mask

one or more file mask expressions separated by one of the values in Separator.

Separator

Character(s) used as a separator between mask expressions in Mask.

CaseSensitiveTrue if the file name to mask comparison is case sensitive.
aOpcodesAllowed

Set of TMaskOpCode values allowed in the comparison.

Function result

True when Filename matches at least one of the masks in the list.

Description

MatchesMaskList is an overloaded Boolean function used to determine whether the specified file name matches at least one of the specified masks. MatchesMaskList is similar to MatchesWindowsMaskList, but uses Unix-style mask expressions. This includes use of the following:

foo*
Matches all files starting with 'foo' regardless of the file extension. Same as foo*.* using MatchesWindowsMaskList.
foo*.
Matches foo* but must not include a file extension.
*.
Matches any file name, but must not include a file extension.
foo.
Matches foo but not foo.txt.
foo.*
Matches foo, foo.txt, or foo.bar.
*
Matches any file name including those with an optional extension.

Overloaded variants of the routine provide arguments and configuration settings, including:

Filename
File name compared to the file masks in Mask.
Mask
Contains one or more file mask expressions separated by one of the values in Separator.
Separator
Contains the character(s) used as a separator between mask expressions in Mask. The default separator is the SemiColon (;) character.
CaseSensitive
Indicates whether the file name to mask comparison is case sensitive.

MatchesMaskList creates a TMaskList instance which uses the values in the Mask, Separator and Options parameters. Its Matches method is called to compare the value in Filename to the mask values in the list.

The return value is True when Filename matches at least one of the masks in the list.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.