You could have figured this out yourself by now, by looking at the methods that the
string
class has or by doing a quick search.
There are actually a set of function to trim chars off a string, these are
Trim()
- Removes all leading and trailing white space
Trim(char[])
- Removes all leading and trailing occurrences of the characters specified
TrimEnd(char[]), TrimStart(char[])
- same as Trim but only on the start, or end of the string
MSDN - String[
^]