aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Sorting/SortHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Sorting/SortHelper.cs')
-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;
+ }
+ }
+}