String Trim Function

C# String Trim function provides the functionality to remove the unwanted special characters from the both side of specified string value. By default Trim function removes the white spaces from both ends of string. But 2nd type of overloaded method of C# Trim function enables you to pass the char array collection of characters that you want to remove from the left end and right end of the string text. You can try the following sample of C# Trim function by passing the impure string having unwanted characters at both ends and a list of characters:

Enter String:
Enter Special Chars:
[Please enter each special character in new new line by pressing enter.]
Output: