C# how to remove string code example
Example 1: c# remove word from string
public static string RemoveHTML(string text)
{
text = text.Replace(" ", " ").Replace("<br>", "\n").Replace("description", "").Replace("INFRA:CORE:", "")
.Replace("RESERVED", "")
.Replace(":", "")
.Replace(";", "")
.Replace("-0/3/0", "");
var oRegEx = new System.Text.RegularExpressions.Regex("<[^>]+>");
return oRegEx.Replace(text, string.Empty);
}
Example 2: c# Remove String In C#
string founder = "Mahesh Chand is a founder of C# Corner";
string first25 = founder.Remove(25);
Console.WriteLine(first25);
String newStr = founder.Remove(10, 12);
Console.WriteLine(newStr);