aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Sorting
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-03-24 16:27:44 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-03-24 16:27:44 -0400
commitcc20c8d7d6c8b46e5026f2ad8d73473dec3fe9d8 (patch)
tree7861b40116f9ec7fb8c8dfee731a7ed53de1293c /MediaBrowser.Controller/Sorting
parent7aa85fc8dd2ea61b54a996cd3233190b85778e0f (diff)
update name sorting
Diffstat (limited to 'MediaBrowser.Controller/Sorting')
-rw-r--r--MediaBrowser.Controller/Sorting/SortHelper.cs31
1 files changed, 31 insertions, 0 deletions
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;
+ }
+ }
+}