asp.net(C#)去除html格式 asp.net开发中,有时需要对读出的文本进行处理,例如不需要html格式,需要数据直接以文本方式显示,这时就需要一个方法来去除html。 具体代码如下: 因为是利用正则来处理,所以需要添加命名空间:[code]using System.Text.RegularExpressions; public static string RemoveHTML(string Htmlstring) { //删除脚本 Htmlstring = Regex.Replace(Htmlstring, @"
asp.net(C#)去除html格式 asp.net开发中,有时需要对读出的文本进行处理,例如不需要html格式,需要数据直接以文本方式显示,这时就需要一个方法来去除html。 具体代码如下: 因为是利用正则来处理,所以需要添加命名空间: using System.Text.RegularExpressions;[code]public static string RemoveHTML(string Htmlstring) { //删除脚本 Htmlstring = Regex.Replace(Htmlstring, @"