Removing String in C#

In this article we will discuss about how to remove the string in C#.
  • 2719

The Remove method deletes a specified number of characters from a string at a specified position. This method returns the result as a string.

For example, the following code removes 13 characters from index starting at 16th position.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
    class Program
        static void Main(string[] args)
            string sentence = "Mahesh Chand is an author and founder of C# Corner";
            Console.WriteLine("Original String: {0}", sentence);
            sentence = sentence.Remove(16, 13);
            Console.WriteLine("Final String");



Further Readings
You may also want to read these related articles.

Ask Your Question 

Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.