HOW TO: Remove Last Character from String
Very often during development we need to remove the last character from a string.
It could be a trailing slash or a trailing comma as a result (side effect ?) of building delimited strings.
There are many ways to do that in C#, however I like the following one for its simplicity and good performance:
str.Remove(str.Length - 1, 1);
Enjoy
Monday, March 10, 2008 3:36 AM