Go homepage(回首页)
Upload pictures (上传图片)
Write articles (发文字帖)

The author:(作者)归海一刀
published in(发表于) 2014/1/30 1:30:38
一段HTML代码组成的页面取其中前300个字_[Asp.Net教程]

一段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个字符



If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)





QQ:154298438
QQ:417480759