Home  |  Delphi .net Home  |  system.String  |  Remove Method
Remove  
Method  
Removes a number of characters from a string
String Class
system NameSpace
CF1.  Function Remove ( Start:IntegerStart : Integer; Count : Integer; ) : String;
CF : Methods with this mark are Compact Framework Compatible
Description
Attempts to remove up to Count characters from the current string, from the Start character index.
Notes
Very Important : Methods in .Net treat strings as starting at 0, unlike traditional Delphi where they started at 1.

Like a lot of string methods, the string object itself is not affected - the modified string is returned for assignment.
Microsoft MSDN Links
system
system.String
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  strA, strB     : String;

begin
  strA := '123456789';

  strB := strA.Remove(5,2);

  Console.WriteLine('strA = ' + strA);
  Console.WriteLine('Removing 2 chars from index=5');
  Console.WriteLine('strB = ' + strB);

  Console.ReadLine;
end.
Show full unit code
  strA = 123456789
  Removing 2 chars from index=5
  strB = 1234589
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author