Strictly speaking,
you can never remove anything from a string. You
cannot add anything to a string. Strings are
immutable.
Look at the answers you already had. In all cases, the string is never modified. Instead, a brand-new string is created based on old string; and the variable on left side is assigned a new value. In this operation, the reference pointed by a variable is changed. It has a serious impact on the performance: all the data is moved left to write, with modification, and then assigned right to left.
That's why such operations should be used with care. For example, multiple concatenation (+) is string is really bad as (ever growing) data goes back and forth. The method
string.Format
does not present such problem. In general case, the mutable class
System.Text.StringBuilder
should be used.
Please see:
http://msdn.microsoft.com/en-us/library/system.string.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.text.stringbuilder.aspx[
^].
—SA