Merge pull request #9799 from Bond-009/genregex

This commit is contained in:
Bond-009
2023-07-06 19:56:00 +02:00
committed by GitHub
25 changed files with 140 additions and 116 deletions

View File

@@ -8,20 +8,19 @@ namespace MediaBrowser.Common.Extensions
/// <summary>
/// Class BaseExtensions.
/// </summary>
public static class BaseExtensions
public static partial class BaseExtensions
{
// http://stackoverflow.com/questions/1349023/how-can-i-strip-html-from-text-in-net
[GeneratedRegex(@"<(.|\n)*?>")]
private static partial Regex StripHtmlRegex();
/// <summary>
/// Strips the HTML.
/// </summary>
/// <param name="htmlString">The HTML string.</param>
/// <returns><see cref="string" />.</returns>
public static string StripHtml(this string htmlString)
{
// http://stackoverflow.com/questions/1349023/how-can-i-strip-html-from-text-in-net
const string Pattern = @"<(.|\n)*?>";
return Regex.Replace(htmlString, Pattern, string.Empty).Trim();
}
=> StripHtmlRegex().Replace(htmlString, string.Empty).Trim();
/// <summary>
/// Gets the Md5.