C#写法

public static string StripHTML(string strHtml)
        {
            string strOutput = strHtml;
            Regex regex = new Regex(@"<[^>]+>|</[^>]+>");
            strOutput = regex.Replace(strOutput, "");
            return strOutput;

        }

javascript写法

e.DesText = e.BannerDes.replace(/<[^>]+>/g, "").replace(/&[^;]+;/g, "");

后面的是替换特殊的字符,如空格,大于号小于号之类的

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
  • 2021-08-15
相关资源
相似解决方案