string class : Trim(string) method
Returns a string that removed specified characters at the beginning and end of the caller.
|string||charList||Characters to remove.|
|string||A string that removed specified characters at the beginning and end.|
string org = "abcbcDDDDDDcbabb";
string result = org.Trim("abc"); // result is "DDDDDD".
It is not "abc" that was deleted. 'a', 'b', and 'c' were removed.
The individual characters in the argument string are removed regardless of their appearance order.
Links for reference