/// <summary>
/// 方法接收一段HTML代码,返回一段代码
/// </summary>
/// <param name="strHtmlCode"></param>
/// <returns></returns>

public string replaceHtmlCode(string strHtmlCode)
{
       string strCode = strHtmlCode.ToString();

       if (strCode.ToString() == "")
       {
           return "";
       }
       else
       {
           strCode = strCode.Replace("<P>", "♂");
           strCode = strCode.Replace("</P>", "♀");
           strCode = strCode.Replace("<BR>", "¢");

           Regex rgx = new Regex(@"<[^>]*>");
           strCode = rgx.Replace(strCode.ToString(), "");
           strCode = strCode.Replace("♂", "");
           strCode = strCode.Replace("♀", "<BR>");
           strCode = strCode.Replace("¢", "<BR>");

           return strCode;
       }

}

相关文章:

  • 2022-12-23
  • 2021-07-09
  • 2021-11-19
  • 2021-12-12
  • 2021-08-20
  • 2021-05-26
  • 2022-12-23
猜你喜欢
  • 2021-10-07
  • 2021-07-08
  • 2021-06-11
  • 2022-02-06
  • 2021-06-20
  • 2021-09-08
  • 2022-12-23
相关资源
相似解决方案