This program will help you to remove a range of characters from a string and also you can remove from a specific postion to end of string. The both methods are mentioned below.
using System;
using System.Text;
namespace MyApp
{
class remove_string_class
{
public static void Main(string[] args)
{
string strOriginal = "Software Testing Tutorials";
Console.WriteLine("Original string: " + strOriginal);
//specific remove
string strNew = strOriginal.Remove(19);
Console.WriteLine("New string: " + strNew);
//range remove
strNew = strOriginal.Remove(5, 15);
Console.WriteLine("New string: " + strNew);
Console.Read();
}
}
}
No comments:
Post a Comment