2016-03-27 21:11:27 +00:00
|
|
|
|
namespace MediaBrowser.Controller.Sorting
|
2016-03-24 20:27:44 +00:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|