Files
quiver-launcher/Services/NameSortHelper.cs
T
Thomas GeorgiadisandCursor cc171d598b Update to version 2.3.7 with gamepad navigation and sorting fixes.
Add Name (ignore The/A/An) sort, stop card-grid wrap, fix rapid D-pad taps and empty catalog Confirm, clear stale filter focus, speed hold-repeat, and move removed apps to Recycle Bin/Trash with Steam OSK support.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-14 22:31:23 +10:00

36 lines
962 B
C#

using System;
namespace Quiver.Services;
public static class NameSortHelper
{
public static string GetAlphabeticalSortKey(string? name)
{
if (string.IsNullOrWhiteSpace(name))
return string.Empty;
var trimmed = name.Trim();
if (TryStripLeadingArticle(trimmed, "the ", out var remainder) ||
TryStripLeadingArticle(trimmed, "an ", out remainder) ||
TryStripLeadingArticle(trimmed, "a ", out remainder))
{
return remainder.Length > 0 ? remainder : trimmed;
}
return trimmed;
}
private static bool TryStripLeadingArticle(string name, string articleWithSpace, out string remainder)
{
if (name.StartsWith(articleWithSpace, StringComparison.OrdinalIgnoreCase))
{
remainder = name[articleWithSpace.Length..].TrimStart();
return true;
}
remainder = string.Empty;
return false;
}
}