//C# Code

static void Main(string[] args)
{
string str = "6,9,4,10,8,2,13";
char[] q = {','};
string[] items = str.Split(q[0]);
int len = items.Length;
string tmp = "";
for (int i = 0; i < len; i++)
{
for (int j = i; j < len; j++)
{
if (Convert.ToInt32(items[i]) > Convert.ToInt32(items[j]))
//if (Convert.ToInt32(items[i]) < Convert.ToInt32(items[j])) 这句是从大到小
{
tmp = items[i];
items[i] = items[j];
items[j] = tmp;
}
}
}
foreach (var p in items)
{
Console.WriteLine(p);
}
Console.ReadKey();
}