From a304c24b32c0327436bbd8c2853e60668e161b42 Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Mon, 29 Dec 2025 00:41:52 +0100 Subject: Rename a lot of stuff, add Santiago real time --- .../Helpers/SortingHelper.cs | 35 ---------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/Costasdev.Busurbano.Backend/Helpers/SortingHelper.cs (limited to 'src/Costasdev.Busurbano.Backend/Helpers/SortingHelper.cs') diff --git a/src/Costasdev.Busurbano.Backend/Helpers/SortingHelper.cs b/src/Costasdev.Busurbano.Backend/Helpers/SortingHelper.cs deleted file mode 100644 index 472a56f..0000000 --- a/src/Costasdev.Busurbano.Backend/Helpers/SortingHelper.cs +++ /dev/null @@ -1,35 +0,0 @@ -namespace Costasdev.Busurbano.Backend.Helpers; - -public class SortingHelper -{ - public static int SortRouteShortNames(string? a, string? b) - { - if (a == null && b == null) return 0; - if (a == null) return 1; - if (b == null) return -1; - - var aDigits = new string(a.Where(char.IsDigit).ToArray()); - var bDigits = new string(b.Where(char.IsDigit).ToArray()); - - bool aHasDigits = int.TryParse(aDigits, out int aNumber); - bool bHasDigits = int.TryParse(bDigits, out int bNumber); - - if (aHasDigits != bHasDigits) - { - // Non-numeric routes (like "A" or "-") go to the beginning - return aHasDigits ? 1 : -1; - } - - if (aHasDigits && bHasDigits) - { - if (aNumber != bNumber) - { - return aNumber.CompareTo(bNumber); - } - } - - // If both are non-numeric, or numeric parts are equal, use alphabetical - return string.Compare(a, b, StringComparison.OrdinalIgnoreCase); - } - -} -- cgit v1.3