2
0

SortHelper.cs 730 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Controller.Sorting
  7. {
  8. public static class SortHelper
  9. {
  10. private enum ChunkType { Alphanumeric, Numeric };
  11. public static bool InChunk(char ch, char otherCh)
  12. {
  13. var type = ChunkType.Alphanumeric;
  14. if (char.IsDigit(otherCh))
  15. {
  16. type = ChunkType.Numeric;
  17. }
  18. if ((type == ChunkType.Alphanumeric && char.IsDigit(ch))
  19. || (type == ChunkType.Numeric && !char.IsDigit(ch)))
  20. {
  21. return false;
  22. }
  23. return true;
  24. }
  25. }
  26. }