jellyfin/MediaBrowser.Controller/Sorting/SortHelper.cs

26 lines
613 B
C#
Raw Normal View History

2016-03-27 14:11:27 -07:00
namespace MediaBrowser.Controller.Sorting
2016-03-24 13:27:44 -07: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;
}
}
}