Description |
The Concat function concatenates (joins) strings String1, String2 ... together into one result string.
It is equivalent to the + operator, which is faster.
|
|
Related commands |
Copy |
|
Create a copy of part of a string or an array |
Delete |
|
Delete a section of characters from a string |
Insert |
|
Insert a string into another string |
Move |
|
Copy bytes of data from a source to a destination |
StringOfChar |
|
Creates a string with one character repeated many times |
StringReplace |
|
Replace one or more substrings found within a string |
WrapText |
|
Add line feeds into a string to simulate word wrap |
|
|
|
|
Example code : Concatenate 3 words into a sentence |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses // The System unit does not need to be defined Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
result : string;
begin // Concatenate using the +
result := 'Hello '+'cruel '+'World';
ShowMessage(result);
// Concatenate using the Concat function
result := Concat('Hello ','cruel ','World');
ShowMessage(result);
end; end.
|
Hide full unit code |
Hello cruel World
Hello cruel World
|
|