aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Sorting/SortHelper.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-03-25 13:52:36 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-03-25 13:52:36 -0400
commitd9108f69f35080acb5ebefaefcd469595529afa2 (patch)
tree3f04e719877b9cdec9529ca34406b753f6492abc /MediaBrowser.Controller/Sorting/SortHelper.cs
parentd6832e7a41c2a24f7dd998284e8e4f6eacf1d188 (diff)
parent72fe76ab1008f0bd38157cc37cde45797b5f6417 (diff)
Merge branch 'master' of https://github.com/MediaBrowser/Emby
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;
+ }
+ }
+}