当前位置: 首页 > news >正文

去除HTML代码得函数

 1 None.gif public   static   string  StripHtmlXmlTags( string  content)
 2 ExpandedBlockStart.gifContractedBlock.gif         dot.gif {
 3InBlock.gif            return Regex.Replace(content, "<[^>]+>""", RegexOptions.IgnoreCase | RegexOptions.Compiled);
 4ExpandedBlockEnd.gif        }

 5 None.gif
 6 ContractedBlock.gifExpandedBlockStart.gif         去除html标签 #region 去除html标签
 7InBlock.gif
 8InBlock.gif        // Strip All Tags from a String
 9ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//*
10InBlock.gif         * Takes a string and strips all bbcode and html from the
11InBlock.gif         * the string. Replacing any <br />s with linebreaks.  This
12InBlock.gif         * method is meant to be used by ToolTips to present a
13InBlock.gif         * a stripped-down version of the post.Body
14InBlock.gif         *
15ExpandedSubBlockEnd.gif         */

16ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
17InBlock.gif        /// 去除所有html标签
18InBlock.gif        /// </summary>
19InBlock.gif        /// <param name="stringToStrip"></param>
20ExpandedSubBlockEnd.gif        /// <returns></returns>

21InBlock.gif        public static string StripAllTags(string stringToStrip)
22ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
23InBlock.gif            // paring using RegEx
24InBlock.gif            //
25InBlock.gif            stringToStrip = Regex.Replace(stringToStrip, "</p(?:\\s*)>(?:\\s*)<p(?:\\s*)>""\n\n", RegexOptions.IgnoreCase | RegexOptions.Compiled);
26InBlock.gif            stringToStrip = Regex.Replace(stringToStrip, "<br(?:\\s*)/>""\n", RegexOptions.IgnoreCase | RegexOptions.Compiled);
27InBlock.gif            stringToStrip = Regex.Replace(stringToStrip, "\"""''", RegexOptions.IgnoreCase | RegexOptions.Compiled);
28InBlock.gif            stringToStrip = StripHtmlXmlTags(stringToStrip);
29InBlock.gif            return stringToStrip;
30ExpandedSubBlockEnd.gif        }

转载于:https://www.cnblogs.com/jillzhang/archive/2006/04/12/373132.html

相关文章:

  • sql 插入数据 返回ID
  • 2019牛客暑期多校训练营(第五场) - C - generator 2 - BSGS
  • How does dbms_stats default granularity AUTO Work?
  • 模板 - SG函数
  • 浪潮之巅第三章 — “水果”公司的复兴 (乔布斯和苹果公司)
  • SCUT - 11 - 被钦定的选手 - 质因数分解
  • notify官方详解
  • heartbeat与lvs和realserver的结合
  • Windows Phone 7 Silverlight开发试玩
  • 我命由我不由天
  • git用法记录
  • 模板 - 日期类
  • POJ数学题目
  • SCUT - 142 - 第n个素数
  • 敏捷开发般若敏捷系列之二:什么是敏捷(上)(无住,不住于法,破法执)...
  • 【面试系列】之二:关于js原型
  • C++类的相互关联
  • centos安装java运行环境jdk+tomcat
  • Javascript设计模式学习之Observer(观察者)模式
  • PHP那些事儿
  • python大佬养成计划----difflib模块
  • Redash本地开发环境搭建
  • Redis提升并发能力 | 从0开始构建SpringCloud微服务(2)
  • springboot_database项目介绍
  • 程序员最讨厌的9句话,你可有补充?
  • 反思总结然后整装待发
  • 函数式编程与面向对象编程[4]:Scala的类型关联Type Alias
  • 检测对象或数组
  • 如何用vue打造一个移动端音乐播放器
  • 视频flv转mp4最快的几种方法(就是不用格式工厂)
  • 一些关于Rust在2019年的思考
  • 智能网联汽车信息安全
  • (C语言)编写程序将一个4×4的数组进行顺时针旋转90度后输出。
  • (JS基础)String 类型
  • (黑客游戏)HackTheGame1.21 过关攻略
  • (蓝桥杯每日一题)love
  • (三)c52学习之旅-点亮LED灯
  • (一)Linux+Windows下安装ffmpeg
  • (已解决)什么是vue导航守卫
  • .form文件_SSM框架文件上传篇
  • .net CHARTING图表控件下载地址
  • .NET Framework 的 bug?try-catch-when 中如果 when 语句抛出异常,程序将彻底崩溃
  • .NET MAUI学习笔记——2.构建第一个程序_初级篇
  • .NET MVC、 WebAPI、 WebService【ws】、NVVM、WCF、Remoting
  • .NET WebClient 类下载部分文件会错误?可能是解压缩的锅
  • .NET使用存储过程实现对数据库的增删改查
  • .pyc文件还原.py文件_Python什么情况下会生成pyc文件?
  • // an array of int
  • @RequestMapping处理请求异常
  • [ CTF ] WriteUp- 2022年第三届“网鼎杯”网络安全大赛(朱雀组)
  • [100天算法】-每个元音包含偶数次的最长子字符串(day 53)
  • [1127]图形打印 sdutOJ
  • [BUG] Authentication Error
  • [BZOJ2208][Jsoi2010]连通数
  • [C++] 默认构造函数、参数化构造函数、拷贝构造函数、移动构造函数及其使用案例