mirror of
https://github.com/tgeorgiadis/quiver-launcher.git
synced 2026-12-06 03:38:02 -05:00
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>
36 lines
962 B
C#
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;
|
|
}
|
|
}
|