NaturalCompareText function
Compare using natural sort.
Declaration
function NaturalCompareText(const S1: string; const S2: string)
: IntegerDescription
NaturalCompareText will compare 2 strings and return one of the
following values:
- -1
- If
S1comes beforeS2 - 0
- If
S1equalsS2 - 1
- If
S1comes afterS2
When S1 and S2 are integer or floating point values,
the actual values are compared. Thus '12' will come after '2'. If either of
the values is not a valid integer or floating point values, the strings are
compared case insensitively as texts using CompareText
A decimal separator and thousands separator can optionally be specified in
ADecSeparator, AThousandSeparator. If none are
specified, the defaults from the system unit will be used.
See also
- CompareText
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
