The trim() function is used to remove the white spaces and other predefined characters from the left and right sides of a string. The string to be trimmed. Specifies the character(s) to remove. Without this remove the following " " an ordinary space.
What is the use of trim ()?
trim() The trim() method removes whitespace from both ends of a string. Whitespace in this context is all the whitespace characters (space, tab, no-break space, etc.)
What is trim method in C#?
C# Trim() is a string method. This method is used to removes all leading and trailing white-space characters from the current String object. This method can be overloaded by passing arguments to it. Syntax: public string Trim() or public string Trim (params char[] trimChars)