EN
C#/.NET - remove characters from string
3 points
In C#/.NET it is possible to remove string characters with String.Remove
method.
xxxxxxxxxx
1
string text = "abc";
2
//string result = text.Remove(text.Length - 1, 1);
3
string result = text.Substring(0, text.Length - 1);
4
Console.WriteLine(text);
Output:
xxxxxxxxxx
1
ab
xxxxxxxxxx
1
string text = "abc";
2
string result = text.Remove(1);
3
Console.WriteLine(result);
Output:
xxxxxxxxxx
1
a
xxxxxxxxxx
1
String text = "abc";
2
String result = text.Remove(1, 1);
3
Console.WriteLine(result);
Output:
xxxxxxxxxx
1
ac