Suppose our string is in following format
string input = “Test1,, Test2,,,,,”;
string result = Regex.Replace(input, “,+”, “,”).Trim(‘,’);

http://stackoverflow.com/questions/4405703/remove-extra-commas-in-c-sharp
Bye.
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

var phone = Regex.Replace(string.Join(“,”, new[]{e.lss_PhoneCell, e.lss_PhoneBus, e.lss_PhoneHome}),”,+”, “,”).Trim(‘,’),
LikeLike