Sign in Join
FPDoc Onlineexperiment

CompareFilenames function

In unit LazFileUtils

Gets the relative sort order for the specified file names.

Declaration

pascal
function CompareFilenames(const Filename1: string; 
 const Filename2: string): Integer; overload

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

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.