Removes all leading and trailing white-space characters from the current string object.
The string that remains after all white-space characters are removed from the start and end of the current string.
The string.Trim method removes from the current string all leading and trailing white-space characters. Each leading and trailing trim operation stops when a non-white-space character is encountered. For example, if the current string is " abc xyz ", the string.Trim method returns "abc xyz".
This method does not modify the value of the current instance. Instead, it returns a new string in which all leading and trailing white space characters found in the current instance are removed.
White-space characters are defined by the Unicode standard. The string.Trim method removes any leading and trailing characters that produce a return value of true when they are passed to the char.IsWhiteSpace(char) method.