1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Core/Helpers/SortHelper.cs
Mark McDowall 2439b9e087 Allow sorting with articles (option)
New: Option to sort with articles (a, the, an) included
2012-12-20 21:36:48 -08:00

27 lines
682 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Helpers
{
public static class SortHelper
{
public static string IgnoreArticles(this string input)
{
if (String.IsNullOrEmpty(input))
return String.Empty;
var articles = new List<string> { "The ", "An ", "A " };
foreach (string article in articles)
{
if (input.ToLower().StartsWith(article, StringComparison.InvariantCultureIgnoreCase))
return input.Substring(article.Length).Trim();
}
return input;
}
}
}