[Overview][Resource strings][Constants][Types][Procedures and functions][Index] Reference for unit 'strutils' (#rtl)


Compare using natural sort


Source position: strutils.pp line 60

function NaturalCompareText(

  const S1: string;

  const S2: string


function NaturalCompareText(

  const Str1: string;

  const Str2: string;

  const ADecSeparator: Char;

  const AThousandSeparator: Char



NaturalCompareText will compare 2 strings and return one of the following values:

If S1 comes before S2
If S1 equals S2
If S1 comes after S2

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


Documentation generated on: Mar 17 2017