Home  |  Delphi .net Home  |  system.String  |  Concat Method
Concat  
Method  
Concatenates one or more instances of String, or the String objects
String Class
system NameSpace
CF1.  Function Concat ( ValueA:StringValueA : String; ValueB : String; ) : String;
CF2.  Function Concat ( ValueA:StringValueA : String; ValueB : String; ValueC : String; ) : String;
CF3.  Function Concat ( ValueA:StringValueA : String; ValueB : String; ValueC : String; ValueD : String; ) : String;
CF4.  Function Concat ( Value : Object; ) : String;
CF5.  Function Concat ( ValueA:ObjectValueA : Object; ValueB : Object; ) : String;
CF6.  Function Concat ( ValueA:ObjectValueA : Object; ValueB : Object; ValueC : Object; ) : String;
CF7.  Function Concat ( ValueA:ObjectValueA : Object; ValueB : Object; ValueC : Object; ValueD : Object; ) : String;
CF8.  Function Concat ( ValueArray : Array of String; ) : String;
CF9.  Function Concat ( ValueArray : Array of Object; ) : String;
CF : Methods with this mark are Compact Framework Compatible
Description
The parameter strings are contenated into a single result string.
 
Objects that have string representations may be used as parameters.
 
Up to 4 strings may be concatenated individually. To concatenate more, the strings must be provided in an array.
Microsoft MSDN Links
system
system.String
 
 
Examples of string, string-array and object concatenations
program Project1;
{$APPTYPE CONSOLE}

var
  strA, strB : String;
  result     : String;
  strArray   : Array[1..3] of String;
  objA, objB : TObject;

begin
  strA := 'ABCDE';
  strB := '---';

  strArray[1] := 'Hello ';
  strArray[2] := 'cruel ';
  strArray[3] := 'World';

  objA := strA;
  objB := strB;

  result := System.String.Concat(strA, strB);
  Console.WriteLine('strA + strB         = ' + result);

  result := System.String.Concat(objA, objB, objA, objB);
  Console.WriteLine('objA+objB+objA+objB = ' + result);

  result := System.String.Concat(strArray);
  Console.WriteLine('strArray            = ' + result);

  Console.ReadLine;
end.
Show full unit code
  strA + strB         = ABCDE---
  objA+objB+objA+objB = ABCDE---ABCDE---ABCDE
  strArray            = Hello cruel World
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author