Remove the extra commas from the string using C#


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.

Advertisements

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

One thought on “Remove the extra commas from the string using C#”

Please share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.