//-----------------------------------------------------------------------
//
// Copyright (c) Pyramid Consulting. All rights reserved.
//
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Bamboo.Core.Common
{
public class StringUtil
{
///
/// Remove all Html tag in a string
///
///
///
public static string RemoveAllHtmlTag(string content)
{
string result = content;
string[] removeTagArray = new string[] { "b", "a", "script", "i", "ul", "li", "ol", "font", "span", "div", "u" };
foreach (string removeTag in removeTagArray)
{
string regExpressionToRemoveBeginTag = string.Format("<{0}([^>]*)>", removeTag);
Regex regEx = new Regex(regExpressionToRemoveBeginTag, RegexOptions.IgnoreCase | RegexOptions.Compiled);
result = regEx.Replace(result, "");
string regExpressionToRemoveEndTag = string.Format("{0}([^>]*)>", removeTag);
regEx = new Regex(regExpressionToRemoveEndTag, RegexOptions.IgnoreCase | RegexOptions.Compiled);
result = regEx.Replace(result, "");
}
return result;
}
}
}