如何在c#中的第一个char之后对列表进行排序

时间:2016-04-18 23:16:17

标签: c#

List<String> stores = new List<String>();

foreach (XmlNode storeXml in storesXml)
{
stores.Add(storeXml.InnerText); 
 can have string id of for e.g.
 s1, s5, s3, s27
}

result.Sort(); 
Console.WriteLine(stores); 

如何对列表进行排序以使列表成为     排序如{s1,s3,s5,s27}

1 个答案:

答案 0 :(得分:1)

这个答案对输入数据做了一些假设。

1)字符串只会在第一个位置始终有一个非数字字符。

2)其余字符将形成正确的Select count(1), sales_date, CASE WHEN sales_id like '1%' THEN substr(sales_id,2,6) WHEN sales_id like '3%' THEN substr(sales_id ,2,6) WHEN sales_id like '4%' THEN substr(sales_id ,2,6) WHEN sales_id like '5%' THEN substr(sales_id ,2,6) WHEN sales_id like '9%' THEN substr(sales_id ,1,6) WHEN sales_id like '70%' OR sales_id like '90%' OR sales_id like '31%' THEN substr(sales_id ,2,6) END AS SALES_ID_CO, case WHEN sales_branch like '10%' AND sales_code<> '678 ' THEN substr(sales_branch,2,6) WHEN sales_branch like '200%' AND sales_code<> '678 ' THEN substr(sales_branch,2,6) WHEN sales_branch like '300%' AND sales_code<> '678 ' THEN substr(sales_branch,2,6) WHEN sales_branch like '456%' AND sales_code<> '678 ' THEN substr(sales_branch,2,6) END AS SALES_BRANCH from tbl_sales_cde where sales_country IN (‘USA’,’ASIA’,’EU’) group by SALES_ID_CO, SALES_BRANCH,SALES_DATE

int

如果需要进行检查,请提供输入字符串格式的完整说明。