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

UTF8CompareLatinTextFast (deprecated)

Deprecated. Use UTF8CompareText or AnsiCompareText instead.

Declaration

Source position: lazutf8.pas line 180

function UTF8CompareLatinTextFast(

  S1: string;

  S2: string

):PtrInt;

Arguments

S1

  

UTF-8-encoded String value used in the comparison.

S2

  

UTF-8-encoded String value used in the comparison.

Function result

Pointer to an Integer with the relative order for the compared values.

Description

UTF8CompareLatinTextFast is like UTF8CompareText, but does not return strict alphabetical order. The order is deterministic and good for binary search and similar uses. It avoids the conversions from UTF-8 to UTF-16 needed to use WideCompareText.

UTF8CompareLatinTextFast optimizes the comparison of values using single-byte encoding by converting uppercase characters to lowercase characters for the comparison. Multi-byte portions (with character values larger than Decimal 127) are optimized to ignore leading bytes sequences common to both compared values.

Otherwise, the routine falls back to AnsiCompareText to compare lowercase ASCII values in S1 and S2.

The return value is a pointer to an Integer where the relative sort order for the compared values is stored.

<0
S1 comes before S2 in the sort order.
>0
S1 comes after S2 in the sort order.
0 (zero)
S1 and S2 have the same value in the sort order.

Version info

Deprecated in LazUtils version 3.2 (Feb 2024).

See also

UTF8CompareText

  

Case-insensitive comparison of two UTF-8-encoded values.

AnsiCompareText


Version 3.2 Generated 2024-02-25 Home