//思路:首先,將源資料篩選,並分別新增到兩個list中;
// 然後,將兩個list分別排序;
// 最後,將排序好的list,迴圈新增到字串陣列中
try
{
//源資料
string[] mxmlfiles = { "mart900_0102.xml", "matr550_01024.xml", "mart900_0101.xml", "matr550_01025.xml" };
//分別存mart900和matr550開頭的資料
List
for (int i = 0; i
//注意mnewstring的值
string mnewstring = mxmlfiles[i].Substring(0, 7);
if (string.Equals("mart900", mnewstring, StringComparison.CurrentCultureIgnoreCase))
listmart900.Add(mxmlfiles[i]);
}
else if (string.Equals("matr550", mnewstring, StringComparison.CurrentCultureIgnoreCase))
listmatr550.Add(mxmlfiles[i]);
//兩個list分別排序
listmart900.Sort();
listmatr550.Sort();
string[] resultmart900 = new string[listmart900.Count];
resultmart900[i] = listmart900[i];
//listmatr550的資料你自己處理一下,呵呵~~~
catch
//思路:首先,將源資料篩選,並分別新增到兩個list中;
// 然後,將兩個list分別排序;
// 最後,將排序好的list,迴圈新增到字串陣列中
try
{
//源資料
string[] mxmlfiles = { "mart900_0102.xml", "matr550_01024.xml", "mart900_0101.xml", "matr550_01025.xml" };
//分別存mart900和matr550開頭的資料
List
List
for (int i = 0; i
{
//注意mnewstring的值
string mnewstring = mxmlfiles[i].Substring(0, 7);
if (string.Equals("mart900", mnewstring, StringComparison.CurrentCultureIgnoreCase))
{
listmart900.Add(mxmlfiles[i]);
}
else if (string.Equals("matr550", mnewstring, StringComparison.CurrentCultureIgnoreCase))
{
listmatr550.Add(mxmlfiles[i]);
}
}
//兩個list分別排序
listmart900.Sort();
listmatr550.Sort();
string[] resultmart900 = new string[listmart900.Count];
for (int i = 0; i
{
resultmart900[i] = listmart900[i];
}
//listmatr550的資料你自己處理一下,呵呵~~~
}
catch
{
}