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

TMask.MatchesWindowsMask

Determines whether a filename matches the mask using Windows file system masks.

Declaration

Source position: masks.pas line 58

public function TMask.MatchesWindowsMask(

  const AFileName: string

):Boolean;

Arguments

AFileName

  

File name examined in the method.

Function result

True when the file name matches the mask value in the class instance.

Description

Determines whether a filename matches the mask value. Implements some special rules for a Windows© file system file masks and comparisons. It is assumed that the initial mask value passed to the constructor uses Windows-specific notation, such as:

foo*.*
Matches all files starting with 'foo' regardless of the file extension. Same as foo* using the Matches method.
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 with an extension.

This is done by converting the Windows-specific file mask to the equivalent notation normally used in the class instance. MatchesWindowsMask calls ClearMaskString and InitMaskString using the altered mask value, and calls the Matches method to perform the comparison. When a Windows-specific file mask is not found, the Matches method is called using the original mask value.

The return value is True when the value in AFileName satisfies the Windows-specific mask expression.

See also

TMask.Matches

  

Determines whether the specified file name matches the mask value.

Masks Overview

  

Masks Overview.