From cc20c8d7d6c8b46e5026f2ad8d73473dec3fe9d8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 24 Mar 2016 16:27:44 -0400 Subject: update name sorting --- MediaBrowser.Controller/Sorting/SortHelper.cs | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 MediaBrowser.Controller/Sorting/SortHelper.cs (limited to 'MediaBrowser.Controller/Sorting/SortHelper.cs') diff --git a/MediaBrowser.Controller/Sorting/SortHelper.cs b/MediaBrowser.Controller/Sorting/SortHelper.cs new file mode 100644 index 000000000..95a3c26c4 --- /dev/null +++ b/MediaBrowser.Controller/Sorting/SortHelper.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +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; + } + } +} -- cgit v1.2.3