You can use StringBuilder.Remove() if you know the position of the characters you want to delete.
I would suggest that it would be easier not to add it in the first place.
Your updated question says removing the last comma character. I assume that you want to do this in order to avoid creating a message that looks like this:
My shopping list contains milk, eggs, butter, and fish.
You would collect this in a loop, iterating over an array. You can usually write a loop so that you simply select (for example, using the if statement) so that you donβt add a command when you are in the last iteration of the loop.
David Heffernan Apr 18 2018-11-11T00: 00Z
source share