Mono Class Library: System.Text.StringBuilder Overview | MembersSystem.Text.StringBuilder.Remove Method |
Removes a specified range of characters from the current instance. [Edit]
|
The current instance after removal has occurred. [Edit]
Type Reason ArgumentOutOfRangeException startIndex or length is less than zero
-or-
The sum of startIndex and length is greater than the length of the current instance.
[Edit]
This method removes the specified range of characters from the current instance. The characters at (startIndex + length) are moved to startIndex, and the string value of the current instance is shortened by length.
Note: The StringBuilder.Replace(string, string) method can be used to remove all instances of a string from a System.Text.StringBuilder.[Edit]
C# Example using System; using System.Text; public class StringBuilderTest { public static void Main() { StringBuilder sb = new StringBuilder("0123456789"); Console.WriteLine(sb); sb.Remove(3, 4); Console.WriteLine(sb); } }The output is
0123456789
012789
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0