Sign in Join
FPDoc Onlineexperiment

FilenameExtIs function

In unit LazFileUtils

Determines if Filename has the specified file extension.

Declaration

pascal
function FilenameExtIs(const Filename: string; const Ext: string; 
 CaseSensitive: Boolean=False): Boolean

Arguments

Filename

File name examined in the routine.

Ext

File extension expected in the file name.

CaseSensitiveTrue to use case-sensitive comparison in the routine.

Function result

Returns True if Filename has the specified file extension.

Description

FilenameExtIs is a Boolean function used to determine if the file in the Filename parameter has the specified file extension in Ext.

Ext can contain the '.' (Period) character in the extension, but it is not required.

CaseSensitive indicates if case-sensitivity is used when comparing parameter values. When set to True, the comparison is limited to values in the ASCII character set. StrLComp or StrLIComp is called to compare the values in Filename to the values in Ext.

The return value is True when Filename uses the file extension in Ext. The return value is False for the following conditions:

  • Filename is an empty string ('').
  • Filename does not have a '.' character that marks the start of the file extension.
  • The extension in Filename has a different length than Ext.
  • Filename has a different file extension than Ext.

See also

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