Overload List
| # | Signature | Description |
|---|---|---|
| 1 | class function Join(const Separator: string; const List: TSubstringList): Substr.Substring; overload; static; | The items of List with Separator between them: Join over a TSubstringList. |
| 2 | class function Join(const Separator: string; const List: TSubstringList; const StartIndex, Count: Integer): Substr.Substring; overload; static; | |
| 3 | class function Join(const Separator: string; const Values: array of const): Substr.Substring; overload; static; | The values of an array of const with Separator between them. |
| 4 | class function Join(const Separator: string; const Values: array of string): Substr.Substring; overload; static; | The values with Separator between them. |
| 5 | class function Join(const Separator: string; const Values: array of string; const StartIndex, Count: Integer): Substr.Substring; overload; static; |
Overload 1: class function Join(const Separator: string; const List: TSubstringList): Substr.Substring; overload; static;
The items of List with Separator between them: Join over a TSubstringList.
| # | Name | Description |
|---|---|---|
| 1 | Separator | The separator, every text kind. |
Returns: Substring - The joined text.
The window form joins Count items from StartIndex (0-based), which must lie inside the list, else ESubstringRangeError is raised.
Joining a list, and a window of it.
uses Substr;
procedure Example;
var List: TSubstringList;
begin
List := TSubstringList.Create(4);
try
List.Add('one');
List.Add('two');
List.Add('three');
Assert(Substring.Join(', ', List) = 'one, two, three');
Assert(Substring.Join('-', List, 1, 2) = 'two-three');
finally
List.Free;
end;
end;
Overload 2: class function Join(const Separator: string; const List: TSubstringList; const StartIndex, Count: Integer): Substr.Substring; overload; static;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Separator | string | |
| 2 | List | TSubstringList | |
| 3 | StartIndex | Integer | |
| 4 | Count | Integer |
Returns: Substring
Overload 3: class function Join(const Separator: string; const Values: array of const): Substr.Substring; overload; static;
The values of an array of const with Separator between them.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Separator | string | |
| 2 | Values | array of const |
Returns: Substring - The joined text.
Numbers, Booleans, characters, texts and class names are written; any other element raises EConvertError.
Numbers and texts.
uses Substr;
procedure Example;
begin
Assert(Substring.Join('|', [1, 'a', 'b']) = '1|a|b');
end;
Overload 4: class function Join(const Separator: string; const Values: array of string): Substr.Substring; overload; static;
The values with Separator between them.
| # | Name | Description |
|---|---|---|
| 1 | Separator | Every text kind. |
| 2 | Values | The strings joined; the window form joins Count of them from StartIndex (0-based), which must lie inside Values, else ESubstringRangeError is raised. |
Returns: Substring - The joined text, sized once.
An array written of single characters, ['a', 'b'], matches this form and the array of const form alike, and the compiler refuses the call as ambiguous; an array of strings of other lengths, or a typed array, selects this one.
Joining strings, and a window of them.
uses Substr;
procedure Example;
begin
Assert(Substring.Join(', ', ['one', 'two', 'three']) = 'one, two, three');
Assert(Substring.Join('-', ['one', 'two', 'three'], 1, 2) = 'two-three');
end;
Overload 5: class function Join(const Separator: string; const Values: array of string; const StartIndex, Count: Integer): Substr.Substring; overload; static;
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Separator | string | |
| 2 | Values | array of string | |
| 3 | StartIndex | Integer | |
| 4 | Count | Integer |
Returns: Substring