Is there any function in C# that remove from string on specific index, for example
string s = \"This is string\";
s.RemoveAt(2);
s is now \"Th
As many others have said, there's a Remove
method. What the other posts haven't explained is that strings in C# are immutable -- you cannot change them.
When you call Remove
, it actually returns a new string; it does not modify the existing string. You'll need to make sure to grab the output of Remove
and assign it to a variable or return it... just calling Remove
on its own does not change the string.