Files
Prowlarr-Prowlarr/NzbDrone.Core/Helpers/SortHelper.cs
Mark McDowall 430fb9aead SortHelper.SkipArticles will no longer bomb when a null is passed.
Added tests for SkipArticles.
2011-10-06 09:37:34 -07:00

27 lines
668 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Helpers
{
public class SortHelper
{
public static string SkipArticles(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;
}
}
}