如何取得一个字符串之间想要的一部分.
我用MSXML提取出前台HTML代码,但是我只想要BODY部分的代码,请问如何取得?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<title> test1 </title>
<meta content= "Microsoft Visual Studio .NET 7.1 " name= "GENERATOR ">
<meta content= "Visual Basic .NET 7.1 " name= "CODE_LANGUAGE ">
<meta content= "JavaScript " name= "vs_defaultClientScript ">
<meta content= "http://schemas.microsoft.com/intellisense/ie5 " name= "vs_targetSchema ">
</HEAD>
<body id= "body1 " MS_POSITIONING= "GridLayout ">
<form name= "Form1 " method= "post " action= "test1.aspx " id= "Form1 ">
<input type= "hidden " name= "__VIEWSTATE " value= "dDwxODA5NjExNTY4Ozs+03UZZBdGTT/tUKSDwjQXHChMgL0= " />
<input type= "submit " name= "Button1 " value= "Button " id= "Button1 " style= "Z-INDEX: 101; LEFT: 312px; POSITION: absolute; TOP: 160px " /> </form>
</body>
</HTML>
------解决方案--------------------int i = IndexOf( " <body ");
int j = IndexOf( " </body> ");
HTMLstr.substring(i,j-i);
------解决方案--------------------using System.Text.RegularExpressions;