【发布时间】:2012-07-07 00:22:38
【问题描述】:
我需要从互联网上加载一个长字符串,我已经做到了。现在我需要找到H1 标头标签并打印内容。
什么是最短或最简单的方法?
for (int x = 0; x < tempString.Length; x++)
{
if (write == 2)
{
name =name + tempString[x];
lenght++;
}
if (tempString[x] == '<' && tempString[x] == 'h' && tempString[x] == '1' )
write = 1;
if (write == 1 && tempString[x] == '>')
write = 2;
if (tempString[x] == '-' && write == 1)
write = 0;
}
我知道怎么说奇怪。但这就是我所拥有的。
【问题讨论】:
-
感谢您的所有帮助,但 atm 我不知道谁给出了最佳答案,因为我在服务器连接上遇到 404 错误
标签: c# html-parsing