WebContnrs.TAbstractNamedVariants.CompareStrings
Delphi
function CompareStrings(const S1, S2: string): Integer; virtual;
C++
virtual int __fastcall CompareStrings(const System::UnicodeString S1, const System::UnicodeString S2);
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
| function | protected | WebContnrs.pas WebContnrs.hpp |
WebContnrs | TAbstractNamedVariants |
Description
Compares two strings.
TAbstractNamedVariants calls CompareStrings internally to locate names in the list (for example, in the implementation of the Values property). Descendant classes can use this method to sort the list entries by name.
S1 and S2 are the strings to compare.
CompareStrings returns a value less than 0 if S1 < S2, 0 if S1 = S2, and a value greater than 0 if S1 > S2.
In TAbstractNamedVariants, CompareStrings calls the AnsiCompareText function. This performs a locale-based case-insensitive comparison. Override this method in a descendant class to change the way the named Variants list compares names. For example, by changing CompareStrings to a case sensitive function, the Values property would distinguish two names that differed only in case.