<FONT style="FONT-SIZE: 10pt" face=微软雅黑 color=#000000>
还有 希望换成空格
其他标签 都换成 需要的
还有 希望换成空格
其他标签 都换成 需要的
解决方案 »
- 超简单的显示问题
- 小白请教:StringBuilder
- C# 网络编程
- 关于listbox
- 要从新学习数据结构了,希望各位大侠给点宝贵的建议。
- DateTime.Now 为什么在html页面可以点出来,而到了后缀为.cs的页面却不能点出来
- 托管线程处理的最佳做法?????????????????
- 关于NCTAUDIOEDITOR2Lib。己添加到vs2010项目中的工具箱,win7下一拖就要关闭程序
- C# 字符串按长度转泛型List<string> 的实现
- 如何将从UserControl继承的控件做成停靠(浮动)效果
- 用WebRequest获取Cookies
- 跪求SerialPort调用时如果串口被拔出的解决方法
{
if (!string.IsNullOrEmpty(str))
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
// Htmlstring = Regex.Replace(Htmlstring, @"([/r/n])[/s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "/", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "/xa1", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "/xa2", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "/xa3", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "/xa9", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&#(/d+);", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"(^\\s*)|(\\s*$)", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"^( )+|^[\\s ]+|( )+$|[\\s ]+$", "", RegexOptions.IgnoreCase);
Htmlstring.Replace("<", "");
Htmlstring.Replace(">", "");
Htmlstring.Replace("\r\n", "");
Htmlstring.Replace("\t", "");
Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();
}
else
{
Htmlstring = null;
} return Htmlstring;
}