aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Sorting/SortHelper.cs
blob: 05981d9757a79c5c51427037f65ad32dc19900cc (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
namespace MediaBrowser.Controller.Sorting
{
    public static class SortHelper
    {
        private enum ChunkType { Alphanumeric, Numeric };

        public static bool InChunk(char ch, char otherCh)
        {
            var type = ChunkType.Alphanumeric;

            if (char.IsDigit(otherCh))
            {
                type = ChunkType.Numeric;
            }

            if ((type == ChunkType.Alphanumeric && char.IsDigit(ch))
                || (type == ChunkType.Numeric && !char.IsDigit(ch)))
            {
                return false;
            }

            return true;
        }
    }
}