Remove multiple char types from end of string
c#, string
Solution
returnValue = returnValue.TrimEnd(' ', ',');
Problem
I have a loop that builds up address fields, some of these fields may be empty at the end of the string ``` List<string> list = new List<string>(); //list can contain any number of values, some of which might be "" (empty string) string returnValue = ""; for (int iRow = 1; iRow <= list.Count; iRow++) returnValue += String.Format("{0}, ", list[iRow]); returnValue = returnValue.Trim(); ``` my output is ``` asd, aaa, qwe, 123123, , , , , ``` How can i remove the trailing ", " from the string?