
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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
- Related Articles
- C# program to remove a range of characters by index using StringBuilder
- Reverse word starting with particular characters - JavaScript
- Python Program to Remove the Characters of Odd Index Values in a String
- Program to find out the letter at a particular index in a synthesized string in python
- How to extract substring from a sting starting at a particular position in MySQL?
- How do I replace a character at a particular index in JavaScript?
- Remove substring from StringBuilder in Java
- C++ Program to Remove all Characters in a String Except Alphabets
- Program to remove duplicate characters from a given string in Python
- Place an H1 element and its text at a particular index in jQuery
- C# Program to remove duplicate characters from String
- Golang Program to get characters from a string using the index
- Copying the entire ArrayList to 1-D Array starting at the specified index in C#
- Remove element at specified index of Collection in C#
- Write a program to find the index of particular element in an array in javascript?

Advertisements