Remove characters in a string using c#
public static void main(String args[])
{
string founder = "Venkatesan Prabu is a founder of Wikitechy";
// Remove all characters after first 25 chars
string first25 = founder.Remove(25);
Console.WriteLine(first25);
// Remove characters start at the 10th position, next 12 characters
String newStr = founder.Remove(10, 12);
Console.WriteLine(newStr);
// Remove everything after founder
int pos = founder.IndexOf("founder");
if (pos >= 0) {
// String after founder
string afterFounder = founder.Remove(pos);
Console.WriteLine(afterFounder);
// Remove everything before founder but include founder
string beforeFounder = founder.Remove(0, pos);
Console.Write(beforeFounder);
}
}