 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# program to remove characters starting at a particular index in StringBuilder
Set StringBuilder −
StringBuilder str = new StringBuilder("Airport"); Let’s say you need to remove characters. For that, use the Remove() method, which removes a bunch of characters beginning with a particular index −
str.Remove(3, 4);
The above removes four characters beginning from 3rd index (i.e. 4th position) −
Here is the complete code −
Example
using System; using System.Text; public class Program {    public static void Main() {       StringBuilder str = new StringBuilder("Airport");       Console.WriteLine("String: "+str);       // removing four characters       Console.Write("String after removing characters: ");       str.Remove(3, 4);       Console.WriteLine(str);    } }  Output
String: Airport String after removing characters: Air
Advertisements
 