我正在使用MVC 3和Razor View引擎。
我正在使用MVC 3制作博客,我想删除所有HTML格式标记,如< p >、< b >、< i >等。
为此,我正在使用以下代码。(它可以正常工作)
我正在使用MVC 3制作博客,我想删除所有HTML格式标记,如< p >、< b >、< i >等。
为此,我正在使用以下代码。(它可以正常工作)
@{
post.PostContent = post.PostContent.Replace("<p>", " ");
post.PostContent = post.PostContent.Replace("</p>", " ");
post.PostContent = post.PostContent.Replace("<b>", " ");
post.PostContent = post.PostContent.Replace("</b>", " ");
post.PostContent = post.PostContent.Replace("<i>", " ");
post.PostContent = post.PostContent.Replace("</i>", " ");
}
我感觉一定有更好的方法来解决这个问题。能否请有经验的人指导一下。