///
/// 智能排序类
///
private class _Comparer : IComparer
{
public int Compare(string a, string b)
{
string x, y;
if (a.Length >= b.Length)
{
x = b;
y = a;
}
else
{
x = a;
y = b;
}
int result = 0;
if (x != y)
{
List
_x = new List
(x.Length);
string s = x[0].ToString();
for (int i = 1; i < x.Length; i++)
{
if (Char.IsSeparator(x[i]))
{
_x.Add(s);
s = null;
i++;
if (i < x.Length)
{
s = x[i].ToString();
}
}
else
{
s += x[i].ToString();
}
}
if (s != null)
{
_x.Add(s);
}
foreach (string item in _x)
{
if (y.IndexOf(item) > -1 && ((float)(item.Length) / (float)(y.Length) > 0.5)) //0.5是相似度
{
return 0;
}
}
result = String.Compare(x, y);
}
return result;
}
}