remove substring from string c# code example
Example 1: remove all text after string c#
string input = "text?here";
int index = input.LastIndexOf("?");
if (index > 0)
input = input.Substring(0, index);
Example 2: c# remove character from string at index
string s = "This is string";
s = s.Remove(2, 1);
string s = "This is string";
s = s.Remove(2, 2);
Example 3: 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);