I want to trim the end off a string if it ends in “, “. That’s a comma and a space.
I’ve tried TrimEnd(', '), but this doesn’t work. It has to be only if the string ends this way, so I can’t just use .Remove to remove the last two characters. How can I do it?
This uses the overload
TrimEnd(params char[] trimChars). You can specify 1 or more chars that will form the set of chars to remove. In this case comma and space.