Topic Path: Symbol Reference > Classes > TIdSysNativeVCL Class > TIdSysNativeVCL Methods > AnsiCompareStr Method
ContentsIndexHome
PreviousUpNext
TIdSysNativeVCL.AnsiCompareStr Method

Compares strings based on the current locale with case sensitivity.

class function AnsiCompareStr(
    const S1: AnsiString; 
    const S2: AnsiString
): Integer; overload;
Parameters 
Description 
S1 
String for the comparision.
 
S2 
String for the comparision. 

Integer - Result for the string comparision.

AnsiCompareStr is an overloaded class method that provides support for Ansi string comparisions in the Sys class helper. 

AnsiCompareStr compares S1 to S2, with case sensitivity. The compare operation is controlled by the current locale. The return value is: 

 

Condition 
Return Value 
S1 > S2 
> 0 
S1 < S2 
< 0 
S1 = S2 
= 0 

 

Please note that most locales consider lowercase characters to be less than the corresponding uppercase characters. This is in contrast to ASCII order, in which lowercase characters are greater than uppercase characters. Thus, setting S1 to 'a' and S2 to 'A' causes AnsiCompareStr to return a value less than zero, while CompareStr, with the same arguments, returns a value greater than zero. 

For environments that natively support the Borland VCL and RTL, AnsiCompareStr calls the function found in the SysUtils.pas unit.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.