LANCommander/LANCommander.Launcher/Extensions/IEnumerableExtensions.cs
Pat Hartl 9ba9887eb1 Rename project files, namespaces, artifacts
Client has been renamed to launcher, and thus namespaces and artifact names had to change. The server project has also had some artifacts renamed in order to create a more clear separation of builds. This will break auto-updates before v0.9.0.
2024-08-04 17:53:19 -05:00

24 lines
751 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace LANCommander.Launcher.Extensions
{
internal static class IEnumerableExtensions
{
static Regex TitleComparisonExpression = new Regex(@"^(?:a|the|an)\s+", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
internal static IOrderedEnumerable<T> OrderByTitle<T>(this IEnumerable<T> items, Func<T, string> keySelector)
{
return items.OrderBy(i =>
{
var key = keySelector.Invoke(i);
return TitleComparisonExpression.Replace(key, "");
});
}
}
}