From 0cc0fbbe4300e58ec4faae9ba9e94787382e1a79 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Tue, 12 Mar 2013 18:49:45 -0400 Subject: #22 - Need to strip html tags from overviews --- MediaBrowser.Common/Extensions/BaseExtensions.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'MediaBrowser.Common/Extensions') diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs index de96901408..f91ddfbd5d 100644 --- a/MediaBrowser.Common/Extensions/BaseExtensions.cs +++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; +using System.Text.RegularExpressions; namespace MediaBrowser.Common.Extensions { @@ -43,6 +44,18 @@ namespace MediaBrowser.Common.Extensions return val.Split(new[] { separator }, options); } + /// + /// Strips the HTML. + /// + /// The HTML string. + /// System.String. + 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); + } + /// /// Shuffles an IEnumerable /// -- cgit v1.2.3