Overload List
Overload 1: class function Compare(const StrA: Substr.Substring; const IndexA: Integer; const StrB: Substr.Substring; const IndexB, Length: Integer): Integer; overload; static;
Compares Length characters of StrA from IndexA with Length characters of StrB from IndexB, ordinal.
| # | Name | Description |
|---|---|---|
| 1 | IndexA | The first character of StrA compared, 0-based. |
| 2 | IndexB | The first character of StrB compared, 0-based. |
| 3 | Length | The characters compared; each window must lie inside its text, else ESubstringRangeError is raised. |
Returns: Integer - 0 when equal, else the difference of the first differing characters.
Note: This routine compares the code units ordinally, case-sensitive and the same under every locale, and does not handle locale specific char handling, but it is 6.4 to 8.8 times faster than its CompareLinguistic alternative.
Comparing windows.
uses Substr;
procedure Example;
begin
Assert(Substring.Compare(Substring('xabc'), 1, 'abc', 0, 3) = 0);
end;
Overload 2: class function Compare(const StrA: Substr.Substring; const IndexA: Integer; const StrB: string; const IndexB, Length: Integer): Integer; overload; static;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | StrA | Substr.Substring | |
| 2 | IndexA | Integer | |
| 3 | StrB | string | |
| 4 | IndexB | Integer | |
| 5 | Length | Integer |
Returns: Integer
Overload 3: class function Compare(const L, R: Substring): Integer; overload; static;
Ordinal comparison by UTF-16 code unit.
Returns: Integer - 0 when equal; else the difference of the first differing characters, or, when one text is a prefix of the other, the difference of the lengths.
Either operand may be a string. An embedded #0 is a character like any other. Note: This routine compares the code units ordinally, case-sensitive and the same under every locale, and does not handle locale specific char handling, but it is 19 to 153 times faster than its CompareLinguistic alternative.
The difference of the first differing characters, and of the lengths.
uses Substr;
procedure Example;
begin
Assert(Substring.Compare(Substring('a'), 'b') = -1);
Assert(Substring.Compare(Substring('abc'), 'ab') = 1);
Assert(Substring.Compare(Substring('abc'), 'abc') = 0);
end;
Overload 4: class function Compare(const L: Substring; const R: string): Integer; overload; static;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | L | Substring | |
| 2 | R | string |
Returns: Integer
Overload 5: class function Compare(const StrA: string; const IndexA: Integer; const StrB: Substr.Substring; const IndexB, Length: Integer): Integer; overload; static;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | StrA | string | |
| 2 | IndexA | Integer | |
| 3 | StrB | Substr.Substring | |
| 4 | IndexB | Integer | |
| 5 | Length | Integer |
Returns: Integer
Overload 6: class function Compare(const L: string; const R: Substring): Integer; overload; static;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | L | string | |
| 2 | R | Substring |
Returns: Integer