标题 | 去除html标签删除html示例代码 |
内容 | 代码如下: /// <summary> /// 去除html标签 /// </summary> /// <param name=htmlstring></param> /// <returns></returns> public static string deletehtml(string htmlstring) { //删除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 = htmlstring.replace(<, ); htmlstring = htmlstring.replace(>, ); htmlstring = htmlstring.replace(\r\n, ); return htmlstring; } |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。