All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
一段HTML代码组成的页面取其中前300个字_[Asp.Net教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/1/30 1:30:38 Browse times: 223 Comment times: 0

一段HTML代码组成的页面取其中前300个字_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

一段HTML代码组成的页面取其中前300个字_[Asp.Net教程] public static string RemoveHtmlTag (string source)
{
int debut;
int fin;
string theTag;

debut = source.IndexOf("<");
fin = source.IndexOf(">");

while ((debut >= 0) && (fin > 0))
{
debut = source.IndexOf("<");
fin = source.IndexOf(">");
if (debut >= fin)
{
debut = 0;
}
fin = fin - debut;
theTag = source.Substring (debut, fin + 1);
if (theTag != "")
{
source = source.Replace (theTag,"");
}
}

source = source.Replace("&nbsp;", " ");
source = source.Replace("&gt;", ">");
source = source.Replace("&amp;", "&"); // Trim
return source;
}

用SubString () 截取前300个字符




There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.