C# how to use the \ character in a char datatype
I would like to trim a \ character from the end of the string. How is this done?
MyString.Value.TrimEnd('\');
simple doesn't work, and开发者_开发技巧 produces a newline in constant error, please help
Change this to
MyString.Value.TrimEnd('\\');
The slash has to be escaped.
\
is an escape character, use \\
instead.
Bobby
This should work:
MyString.Value.TrimEnd((char)92);
精彩评论