remove an element from stringc# code example
Example 1: c# remove specific character from string
string phrase = "this is, a string with, too many commas";
phrase = phrase.Replace(",", "");
Example 2: C# copy string except for last letter
using System;
class Program
{
static void Main()
{
string input = "OneTwoThree";
string sub = input.Substring(0, input.Length - 5);
Console.WriteLine("Substring: {0}", sub);
}
}
Output
Substring: OneTwo