diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-03-12 18:49:45 -0400 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-03-12 18:49:45 -0400 |
| commit | 0cc0fbbe4300e58ec4faae9ba9e94787382e1a79 (patch) | |
| tree | 292c8d97cc00aea0665490f896b6f507a134826a /MediaBrowser.Common/Extensions/BaseExtensions.cs | |
| parent | 6b327581c690b5c1c6241ab10adce8d56e6fdb68 (diff) | |
#22 - Need to strip html tags from overviews
Diffstat (limited to 'MediaBrowser.Common/Extensions/BaseExtensions.cs')
| -rw-r--r-- | MediaBrowser.Common/Extensions/BaseExtensions.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs index de9690140..f91ddfbd5 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 { @@ -44,6 +45,18 @@ namespace MediaBrowser.Common.Extensions } /// <summary> + /// Strips the HTML. + /// </summary> + /// <param name="htmlString">The HTML string.</param> + /// <returns>System.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); + } + + /// <summary> /// Shuffles an IEnumerable /// </summary> /// <typeparam name="T"></typeparam> |
