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

CompareFilenames

Gets the relative sort order for the specified file names.

Declaration

Source position: lazfileutils.pas line 29

function CompareFilenames(

  const Filename1: string;

  const Filename2: string

):Integer; overload;

function CompareFilenames(

  Filename1: PChar;

  Len1: Integer;

  Filename2: PChar;

  Len2: Integer

):Integer; overload;

Arguments

Filename1

  

First file name for the comparison.

Filename2

  

Second file name for the comparison.

Function result

Relative sort order for the specified file names.

Arguments

Filename1

  

First file name for the comparison.

Len1

  

Length of the first file name.

Filename2

  

Second file name for the comparison.

Len2

  

Length of the seconds file name.

Description

CompareFilenames is an overloaded Integer function used to compare the specified file names to get their relative order for sorting operations. CompareFilenames provides implementations which accept String or PChar values (and their lengths) as arguments. The implementations are platform- and/or OS-specific; they consider whether the file system is case sensitive or when UTF-8 encoding is supported.

The return value indicates the relative order in a sort operation, and can contain the following values:

<0
Filename1 comes before Filename2
0
Filename1 and Filename2 to have the same value
>0
Filename1 comes after Filename2

See also

CompareFilenamesIgnoreCase

  

Gets the relative sort order for case-insensitive file names.


Version 4.0 Generated 2025-05-03 Home