Home  |  Delphi .net Home  |  System.String  |  Copy Method
  
Copy  
Method  
Creates a new instance of String with the same value as a specified String.
String Class
System NameSpace
CF1.  Function Copy ( Source : String ) : String;
CF : Methods with this mark are Compact Framework Compatible
Description
The Source string object is copied to the target (result) string. The target is a new string rather than a reference to the original string. This means that any updates to the original source string are isolated to that string.
Microsoft MSDN Links
System
System.String
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  strA, strB : String;

begin
  strA := 'First';
  strB := 'Second';

  Console.WriteLine('Before copy');
  Console.WriteLine('strA = ' + strA);
  Console.WriteLine('strB = ' + strB);

  strB := System.String.Copy(strA);

  Console.WriteLine('After copy of strA to strB');
  Console.WriteLine('strA = ' + strA);
  Console.WriteLine('strB = ' + strB);

  strA := 'First updated';

  Console.WriteLine('After update of strA');
  Console.WriteLine('strA = ' + strA);
  Console.WriteLine('strB = ' + strB);

  Console.ReadLine;
end.
   Before copy
   strA = First
   strB = Second
   After copy of strA to strB
   strA = First
   strB = First
   After update of strA
   strA = First updated
   strB = First
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author