Substring.CompareAscii Method

Overload List

#SignatureDescription
1class function CompareAscii(const StrA: string; const IndexA: Integer; const StrB: string; const IndexB, Length: Integer; const IgnoreCase: Boolean): Integer; overload; static;
2class function CompareAscii(const StrA, StrB: string; const IgnoreCase: Boolean): Integer; overload; static;Compares StrA with StrB, or Length characters of each from IndexA and IndexB (0-based), by UTF-16 code unit; IgnoreCase True folds 'a'..'z' to upper case.

Overload 1: class function CompareAscii(const StrA: string; const IndexA: Integer; const StrB: string; const IndexB, Length: Integer; const IgnoreCase: Boolean): Integer; overload; static;

#NameTypeDescription
1StrAstring
2IndexAInteger
3StrBstring
4IndexBInteger
5LengthInteger
6IgnoreCaseBoolean

Returns: Integer

Overload 2: class function CompareAscii(const StrA, StrB: string; const IgnoreCase: Boolean): Integer; overload; static;

Compares StrA with StrB, or Length characters of each from IndexA and IndexB (0-based), by UTF-16 code unit; IgnoreCase True folds 'a'..'z' to upper case.

#NameTypeDescription
1StrAstring
2StrBstring
3IgnoreCaseBoolean

Returns: Integer - 0 when equal, else the difference of the first differing pair, or of the lengths when one text is a prefix of the other.

Remarks:

Every text kind, both texts of one kind. A window outside its text raises ESubstringRangeError. Note: This routine handles only ANSI/ASCII case char mapping and does not handle locale specific char handling, but it is 11 to 65 times faster than its CompareLinguistic alternative.

Examples

Case ignored.

uses Substr;

procedure Example;
begin
    Assert(Substring.CompareAscii('abc', 'ABC', True) = 0);
    Assert(Substring.CompareAscii('xABC', 1, 'abc', 0, 3, True) = 0);
end;
See Also: Substring.CompareInvariant, Substring.CompareInvariant, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic, Substring.CompareLinguistic