I have a string like "abc,,bcd,";
The output should be abc,bcd i.e. the extra commas should be removed.
Help needed
string result = Regex.Replace(input, ",+", ",").Trim(',');
How about something like
string s = "abc,,bcd,";
s = s.Trim(',');
while (s.Contains(",,"))
s = s.Replace(",,", ",");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With