Create comma separated string

To Create comma separated string…..

Declare 3 variable  called min, max, and intString to hold value. [you can use string also]

int max = 10;
int min = 1;
int intString = “”;

for (int icnt = min; icnt <= max; icnt++)
{

if intString == “”)
{
intString = Convert.ToString(icnt);
}
else
{
intString = Convert.ToString(intString) + “,” + Convert.ToString(icnt);
}

}

 

Happy Coding…!!! 🙂

Advertisements

Leave a Reply

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s