如何仅选择< body>#information< / body>从html文件不使用第三方DLL [英] How to select only <body>#information</body> from html File without using Third party dll
本文介绍了如何仅选择< body>#information< / body>从html文件不使用第三方DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello Everyone,
我有一个问题,我有一个HTML文件,我想只选择< body>#information< / body>并且不使用任何第三方dll将其放在另一个文件上。
请有人为我提供解决方案。
谢谢,
Samadhan
Hello Everyone,
I have one issue,I have one HTML file , from that I want to select only <body>#information</body> and put it on another file without using any third party dll.
please anyone provide me solution on it.
Thanks,
Samadhan
推荐答案
请阅读我对这个问题的评论。
这是非常有趣的课程:将HTML转换为文本 [< a href =http://www.blackbeltcoder.com/Articles/strings/convert-html-to-texttarget =_ blanktitle =New Window> ^ ]
Please, read my comment to the question.
Here is very interesting class: Convert HTML to Text[^]
你可以像这样提取身体内容:
Hi,
you could extract the body content like this:
string ExtractBody(string html)
{
int bodyBegin = html.IndexOf("<body>") + "<body>".Length;
int bodyEnd = html.IndexOf("</body>");
int bodyLength = bodyEnd - bodyBegin;
return html.Substring(bodyBegin, bodyLength);
}
快乐编码,
Stephan
Happy coding,
Stephan
使用正则表达式:
Use a regex:
<body>.*</body>
应该这样做。
这篇关于如何仅选择< body>#information< / body>从html文件不使用第三方DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文