Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ClassicSorter.cs « CoolgirlCombiner « tools_sources - github.com/coolgirl-multicart/coolgirl-multirom-builder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 587786d42285d93d814ef6e20973d16dfd160584 (plain)
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
29
30
using System.Collections.Generic;

namespace com.clusterrr.Famicom.CoolGirl
{
    public class ClassicSorter : IComparer<string?>
    {
        public int Compare(string? x, string? y)
        {
            int p = 0;
            if (x == null) return 1;
            if (y == null) return -1;
            x = x.ToUpper();
            y = y.ToUpper();
            while (true)
            {
                if ((p >= x.Length) && (p >= y.Length))
                    return 0;
                else if (p >= x.Length)
                    return -1;
                else if (p >= y.Length)
                    return 1;
                else if (x[p] < y[p])
                    return -1;
                else if (x[p] > y[p])
                    return 1;
                p++;
            }
        }
    }
}