System.SysUtils.TStringHelper.Join
Delphi
class function Join(const Separator: string; const values: array of const): string; overload; static;
class function Join(const Separator: string; const Values: array of string): string; overload; static;
class function Join(const Separator: string; const Values: IEnumerable<string>): string; overload; static;
class function Join(const Separator: string; const value: array of string; StartIndex: Integer; Count: Integer): string; overload; static;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.SysUtils.pas | System.SysUtils | TStringHelper |
Description
Joins two or more 0-based strings together separated by the given Separator
.
begin
Writeln(String.Join(',', ['String1', 'String2', 'String3']));
Writeln(String.Join(',', ['String1', 'String2', 'String3'], 1, 2));
end.
Output:
String1,String2,String3 String2,String3
There are four System.SysUtils.TStringHelper.Join overloaded methods. The first and the third ones always return an empty string ('') in the current implementation. The other two overloaded methods allow you to either join any number of strings together or either start joining from the given start string index in the array up until the given end string index in the array. See code snippet above.