Home  |  Delphi .net Home  |  System.String  |  Insert Method
  
Insert  
Method  
Inserts a string into another string, creating a new, longer string
String Class
System NameSpace
CF1.  Function Insert ( Start : Integer; Value : String ) : String;
CF : Methods with this mark are Compact Framework Compatible
Description
A new string is created that contains the source string with Value string inserted at the Start position.
 
Note that the method leaves the original string unchanged.
 
Essentially, the Start value can alternatively be treated as a count of characters before the string is inserted.
Notes
Very Important : Methods in .Net treat strings as starting at 0, unlike traditional Delphi where they started at 1.
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, strC : String;

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

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

  strC := strA.Insert(4, strB);

  Console.WriteLine('strC = ' + strC);

  Console.ReadLine;
end.
   strA = 123456789
   strB = ------
   strC = 1234------56789
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author