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