-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathNameComparer.cs
More file actions
28 lines (26 loc) · 728 Bytes
/
Copy pathNameComparer.cs
File metadata and controls
28 lines (26 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Collections.Generic;
using System.Linq;
namespace HtmlExporterPlugin
{
public class NameComparer : IComparer<string>
{
public int Compare(string x, string y)
{
return String.Compare(Convert(x), Convert(y), StringComparison.OrdinalIgnoreCase);
}
public string Convert(string value)
{
string newvalue = value.Trim();
if (String.IsNullOrEmpty(newvalue))
{
return "1";
}
else
{
var firstChar = Char.ToUpper(newvalue[0]);
return Char.IsLetter(firstChar) ? "2" + newvalue : "1" + newvalue;
}
}
}
}