diff options
| author | Bond_009 <bond.009@outlook.com> | 2023-05-22 22:48:09 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2023-06-28 17:07:57 +0200 |
| commit | b5f0760db8dba96e9edd67d4b9c914cf25c3d26a (patch) | |
| tree | a60f87f379ddbfe2436d03b3b1a8f48cbc3b7490 /MediaBrowser.Common/Extensions | |
| parent | f954dc5c969ef5654c31bec7a81b0b92b38637ae (diff) | |
Use RegexGenerator where possible
Diffstat (limited to 'MediaBrowser.Common/Extensions')
| -rw-r--r-- | MediaBrowser.Common/Extensions/BaseExtensions.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs index e3775021e..3615b662b 100644 --- a/MediaBrowser.Common/Extensions/BaseExtensions.cs +++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs @@ -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. |
