System.SysUtils.TStringHelper.Join

From RAD Studio API Documentation
Jump to: navigation, search

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: IEnumerator<string>): string; overload; static;
class function Join(const Separator: string; const Values: IEnumerable<string>): string; overload; static; inline;
class function Join(const Separator: string; const Values: 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 five Join overloaded methods:

  • The first Join overloaded method concatenates the elements of a constant array, using the specified Separator between each element.
  • The second Join overloaded method concatenates all the elements of a string array, using the specified Separator between each element.
  • The third Join overloaded method concatenates the elements of an object array, using the specified Separator between each element.
  • The fourth Join overloaded method concatenates the elements of a IEnumerable, using the specified Separator between each member.
  • The fifth Join overloaded method concatenates the specified elements of a string array, using the specified Separator between each element.

See Also