RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.Concat Function

Concatenates two or more strings into one.

Pascal
function Concat(s1: string): string; overload;
function Concat(s1: string; s2: string): string; overload;
function Concat(s1: string; s2: string; s3: string): string; overload;
C++

System

In Delphi code, use Concat to concatenate an arbitrary number of strings. Each parameter is a string-type expression. The result is the concatenation of all the string parameters. 

The syntax shown here for Concat demonstrates that the procedure can take a variable number of arguments. 

Using the plus (+) operator has the same effect on two strings as using the Concat function: 

S := 'ABC' + 'DEF';

Tip: The plus operator is faster than Concat.
 

Delphi Examples: 

 

{
This example requires a button and three text fields.
Select the button to concatenate the two texts into
the third.
}
procedure TForm1.Button1Click(Sender: TObject);
var
  S: string;
begin
  Edit3.Text := Concat(Edit1.Text, Edit2.Text);     { 'ABCDEF' }
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!