From Appmethod Libraries
Jump to: navigation, search

Object Pascal

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


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


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


Compare two strings with case-sensitivity.

CompareStr compares the strings S1 to S2, with case-sensitivity. The return value is less than 0 if S1 < S2, 0 if S1 = S2, or greater than 0 if S1 > S2. The compare operation is based on the 8-bit ordinal value of each character and is not affected by the current user locale.

Use CompareText to compare strings without case-sensitivity.

Use AnsiCompareStr to compare strings for the current user locale.

See Also

Code Examples