如何把网页源代码截取呢?

2025-01-05 08:47:40
推荐回答(2个)
回答(1):

用字符串函数
例如
Substring
string str="abcdefg";
string str1=str.Substring(2,3);//str1="cde"
先找 位置即可</p> </div> </div> <div class="clear"></div> </div> <div class="wdhdnr"> <div class="huidanrtop"> <div class="wdhuidaxinx"> <div class="wdhuidaxm">回答(2):</div> </div> </div> <div class="clear"></div> <div class="wdhuidanrmid"> <div class="zuijiacont"> <p>string str = strm.ReadToEnd();<br> str = str.Substring(str.IndexOf("<title>")+7,str.IndexOf("")-str.IndexOf("")-7);<br> richTextBox1.Text = str;</p> </div> </div> <div class="clear"></div> </div> </div> </div> <div class="wendaright"> <div class="wdluluerwema"> <div class="wdxgwttop">相关问答</div> <div class="wdxgwtnr"> </div> <div class="clear"></div> </div> <!-- 其他随机问答['id'=>alphaID($like['zid'])] --> <div class="wdluluerwema"> <div class="wdxgwttop">最新问答</div> <div class="wdxgwtnr"> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/502077492.html">丑女大变身txt全集下载</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/1861460491505757747.html">和绝命毒师差不多的美剧有没有?</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/507676112.html">这个配置能玩使命召唤9,热血无赖,GTA5等大型单机游戏吗?</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/561613428.html">想报考华中师范大学中文系中国现当代文学史方向的研究生,请问要考哪几门?推荐基本教材.谢了</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/322112614.html">你好,请问我的一个朋友的了皮肤病,他不知道去哪里治疗,请大家给个提议</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/1899047227337635620.html">胰腺炎恢复期吃什么蔬菜,食物比较好</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/307633913.html">武林外传ol 冰火岛史诗任务 序章 要不要做?有没有做的必要?</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/583674472.html">求:一个动漫的人的名字叫亚瑟王,是个女人,好像抢圣杯吧!这是什么动漫</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/276164774.html">求高人指点 帮我化解 上了大学之后就一直很倒霉 做什么都不顺 不断出事 后来才知道是和我宿舍的床位有关</a></div> </div> <div class="wdxgwtcont"> <div class="wdxgtitle"><a href="https://58z.net/z/573850683.html">阅读伴我与孩子共成长作文</a></div> </div> </div> </div> </div> <div class="clear"></div> <div class="footer"> <!-- 移动底部导航 --> <div class="fanhuitop"><a href="#top" ref="nofollow"><img src="https://58z.net/static/old/img/fhtop.png" alt="返回顶部" title="返回顶部"></a></div> <div class="dibu"> <div class="dibu"> </div> </div> <div class="banquan"> <p>内容全部来源于网络收集,如有侵权,请联系网站删除:QQ:24596024</p> </div> </div> </div> </div> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?bc215519b6d2b72984cdb0a467b5dcf6"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </body> </html>