去除HTML代码的函数
来源:互联网 发布:通讯网络规模效益 编辑:程序博客网 时间:2024/04/30 10:25
public static string StripHtmlXmlTags(string content)
2 {
3 return Regex.Replace(content, "<[^>]+>", "", RegexOptions.IgnoreCase | RegexOptions.Compiled);
4 }
5
6 去除html标签#region 去除html标签
7
8 // Strip All Tags from a String
9 /**//*
10 * Takes a string and strips all bbcode and html from the
11 * the string. Replacing any <br />s with linebreaks. This
12 * method is meant to be used by ToolTips to present a
13 * a stripped-down version of the post.Body
14 *
15 */
16 /**//// <summary>
17 /// 去除所有html标签
18 /// </summary>
19 /// <param name="stringToStrip"></param>
20 /// <returns></returns>
21 public static string StripAllTags(string stringToStrip)
22 {
23 // paring using RegEx
24 //
25 stringToStrip = Regex.Replace(stringToStrip, "</p(?://s*)>(?://s*)<p(?://s*)>", "/n/n", RegexOptions.IgnoreCase | RegexOptions.Compiled);
26 stringToStrip = Regex.Replace(stringToStrip, "<br(?://s*)/>", "/n", RegexOptions.IgnoreCase | RegexOptions.Compiled);
27 stringToStrip = Regex.Replace(stringToStrip, "/"", "''", RegexOptions.IgnoreCase | RegexOptions.Compiled);
28 stringToStrip = StripHtmlXmlTags(stringToStrip);
29 return stringToStrip;
30 }
2 {
3 return Regex.Replace(content, "<[^>]+>", "", RegexOptions.IgnoreCase | RegexOptions.Compiled);
4 }
5
6 去除html标签#region 去除html标签
7
8 // Strip All Tags from a String
9 /**//*
10 * Takes a string and strips all bbcode and html from the
11 * the string. Replacing any <br />s with linebreaks. This
12 * method is meant to be used by ToolTips to present a
13 * a stripped-down version of the post.Body
14 *
15 */
16 /**//// <summary>
17 /// 去除所有html标签
18 /// </summary>
19 /// <param name="stringToStrip"></param>
20 /// <returns></returns>
21 public static string StripAllTags(string stringToStrip)
22 {
23 // paring using RegEx
24 //
25 stringToStrip = Regex.Replace(stringToStrip, "</p(?://s*)>(?://s*)<p(?://s*)>", "/n/n", RegexOptions.IgnoreCase | RegexOptions.Compiled);
26 stringToStrip = Regex.Replace(stringToStrip, "<br(?://s*)/>", "/n", RegexOptions.IgnoreCase | RegexOptions.Compiled);
27 stringToStrip = Regex.Replace(stringToStrip, "/"", "''", RegexOptions.IgnoreCase | RegexOptions.Compiled);
28 stringToStrip = StripHtmlXmlTags(stringToStrip);
29 return stringToStrip;
30 }
- 去除HTML代码的函数
- 去除HTML代码的类
- 去除HTML代码的方法
- asp去除html代码的方法
- 去除html代码里面的script正则
- java去除内容的html代码
- 去除HTML代码,特别是残缺的HTML代码
- php里去除html标记的函数
- php里去除html标记的函数
- 去除HTML的正则表达式函数
- 去除HTML代码
- 去除html代码
- 去除HTML代码
- java去除html代码
- C#去除指定字符串中的HTML标签相关代码函数
- w3lib.html remove_tags()函数 去除html的tags
- 去除字符串中的Html代码
- innerHtml 去除 html 标签代码
- 荀氏族谱
- 判断用户什么时候离开,以什么方式离开
- 《吉祥三宝—外企版》
- 经典笑话(看看笑一笑就是了!)
- 西凉人物一览
- 去除HTML代码的函数
- 袁氏人物一览
- 刘表人物一览
- 如何实现网页上的气球提示
- 定时发邮件
- 公孙氏人物一览
- JAVA基础:如何才能成为Java开发高手
- 李开复:算法的力量
- adodb.recordset.open sqlstr,conn,3,3后面的两个差数是什么意思