[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'Masks' (#lazutils)

MatchesMask

Indicates whether the file name matches the specified mask.

Declaration

Source position: masks.pas line 374

function MatchesMask(

  const FileName: string;

  const Mask: string;

  CaseSensitive: Boolean = False;

  aOpcodesAllowed: TMaskOpCodes = DefaultMaskOpCodes

):Boolean;

function MatchesMask(

  const FileName: string;

  const Mask: string;

  Options: TMaskOptions

):Boolean;

Arguments

FileName

  

File name compared to the mask value.

Mask

  

Mask used to perform the comparison.

CaseSensitive

  

True when case sensitivity should be used in the comparison.

aOpcodesAllowed

  

Set of TMaskOpCode values allowed in the comparison.

Function result

True when the file name matches the mask value using the specified options.

Arguments

FileName

  

File name compared to the mask value.

Mask

  

Mask used to perform the comparison.

Options

  

Set of options enabled for the comparison.

Description

MatchesMask is an overloaded Boolean function used to determine if the file name specified in FileName matches the specified Mask.

CaseSensitive indicates whether case sensitivity is used when comparing the file name to the mask value.

Options contains a set of zero or more TMaskOption values enabled for the comparison. The Options argument allows enabling or disabling set notation in the mask value. Specifying moDisableSets in the Options parameter will disable interpreting the ' [' character as the beginning of a set in the specified mask. Use an empty set (' []') when options from the TMaskOption enumeration are not needed.

For example:

MatchesMask('[x]','[x]',[moDisableSets]);  // returns True

MatchesMask creates a TMask instance which is used to compare the file name to the mask using the specified options. Values in Mask and Options are passed as arguments the TMask constructor. The Matches method in the instance is called using FileName as an argument, and gets the return value for the function.

Remark: The overloaded variant which includes a TMaskOptions parameter has been marked as deprecated in version 2.3. It will be removed in version 2.5.

See also

Masks Overview

  

Masks Overview.


Version 4.0 Generated 2025-05-03 Home