SortHelper.cs 610 B

12345678910111213141516171819202122232425
  1. namespace MediaBrowser.Controller.Sorting
  2. {
  3. public static class SortHelper
  4. {
  5. private enum ChunkType { Alphanumeric, Numeric };
  6. public static bool InChunk(char ch, char otherCh)
  7. {
  8. var type = ChunkType.Alphanumeric;
  9. if (char.IsDigit(otherCh))
  10. {
  11. type = ChunkType.Numeric;
  12. }
  13. if ((type == ChunkType.Alphanumeric && char.IsDigit(ch))
  14. || (type == ChunkType.Numeric && !char.IsDigit(ch)))
  15. {
  16. return false;
  17. }
  18. return true;
  19. }
  20. }
  21. }