mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
761 B
34 lines
761 B
namespace ErsatzTV.Core.Metadata; |
|
|
|
public static class SortTitle |
|
{ |
|
public static string GetSortTitle(string title) |
|
{ |
|
if (string.IsNullOrWhiteSpace(title)) |
|
{ |
|
return title; |
|
} |
|
|
|
if (title.StartsWith("the ", StringComparison.OrdinalIgnoreCase)) |
|
{ |
|
return title[4..]; |
|
} |
|
|
|
if (title.StartsWith("a ", StringComparison.OrdinalIgnoreCase)) |
|
{ |
|
return title[2..]; |
|
} |
|
|
|
if (title.StartsWith("an ", StringComparison.OrdinalIgnoreCase)) |
|
{ |
|
return title[3..]; |
|
} |
|
|
|
if (title.StartsWith("Æ", StringComparison.OrdinalIgnoreCase)) |
|
{ |
|
return title.Replace("Æ", "E"); |
|
} |
|
|
|
return title; |
|
} |
|
}
|
|
|