예제 #1
0
 static StringLogicalComparer()
 {
     Default           = new StringLogicalComparer();
     CaseInsensitive   = new StringLogicalComparer(true, false);
     DetectFloatNumber = new StringLogicalComparer(false, true);
     IgnoreCaseAndDetectFloatNumber = new StringLogicalComparer(true, true);
 }
예제 #2
0
        static void Main(string[] args)
        {
            var array = new[] { "AB1", "AB10", "AB21", "AB3", "AB11", "AB2", "AB20", "AB30", "AB31" };

            Console.WriteLine("SOURCE: {0}", String.Join(", ", array));

            var ordinalComparer = StringComparer.Ordinal;

            Array.Sort(array, ordinalComparer);

            Console.WriteLine("ORGINAL: {0}", String.Join(", ", array));

            var logicalComparer = new StringLogicalComparer();

            Array.Sort(array, logicalComparer);

            Console.WriteLine("LOGICAL: {0}", String.Join(", ", array));
        }