From RAD Studio API Documentation
Jump to: navigation, search


function CompareStr(const S1, S2: string): Integer;
function CompareStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer;


extern DELPHI_PACKAGE int __fastcall CompareStr(const System::UnicodeString S1, const System::UnicodeString S2)/* overload */;


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Compares two strings, with case sensitivity.

CompareStr compares S1 to S2, with case sensitivity. The return value is less than 0 if S1 is less than S2, 0 if S1 equals S2, or greater than 0 if S1 is greater than S2. The comparison operation is based on the 16-bit ordinal value of each character and is not affected by the current locale, when using the first CompareStr overloaded method.

The LocaleOptions parameter of the second CompareStr overloaded method is of type TLocaleOptions and defines a choice of dependent and independent locale options. For more information, please refer to the TLocaleOptions topic.

See Also

Code Examples