3 // Test case for bug: #349034
6 using System
.Collections
.Generic
;
7 using System
.Text
.RegularExpressions
;
10 private static void TestNaturalSort()
12 Comparison
<string> naturalSortComparer
= (left
, right
) => {
13 return Regex
.Replace(left
?? "", @"([\d]+)|([^\d]+)", m
=>
14 (m
.Value
.Length
> 0 && char.IsDigit(m
.Value
[0])) ?
15 m
.Value
.PadLeft(Math
.Max((left
?? "").Length
, (right
?? "").Length
)) :
16 m
.Value
).CompareTo(Regex
.Replace(right
?? "", @"([\d]+)|([^\d]+)", m
=>
17 (m
.Value
.Length
> 0 && char.IsDigit(m
.Value
[0])) ?
18 m
.Value
.PadLeft(Math
.Max((left
?? "").Length
, (right
?? "").Length
)) :
23 public static void Main ()