Add EndsWithIgnoreCase and ContainsIgnoreCase

This commit is contained in:
Bogdan 2023-10-30 19:50:35 +02:00
parent cbb1ed2b16
commit d5ac008747
1 changed files with 10 additions and 0 deletions

View File

@ -114,6 +114,11 @@ namespace NzbDrone.Common.Extensions
return text.StartsWith(startsWith, StringComparison.InvariantCultureIgnoreCase);
}
public static bool EndsWithIgnoreCase(this string text, string startsWith)
{
return text.EndsWith(startsWith, StringComparison.InvariantCultureIgnoreCase);
}
public static bool EqualsIgnoreCase(this string text, string equals)
{
return text.Equals(equals, StringComparison.InvariantCultureIgnoreCase);
@ -164,6 +169,11 @@ namespace NzbDrone.Common.Extensions
return CamelCaseRegex.Replace(input, match => " " + match.Value);
}
public static bool ContainsIgnoreCase(this IEnumerable<string> source, string value)
{
return source.Contains(value, StringComparer.InvariantCultureIgnoreCase);
}
public static double FuzzyMatch(this string a, string b)
{
if (a.IsNullOrWhiteSpace() || b.IsNullOrWhiteSpace())