📄 webinfo.cs
字号:
using System;
namespace BaseInfo
{
/// <summary>
/// webInfo 的摘要说明。
/// </summary>
public class webInfo
{
public webInfo()
{
}
#region 根据url得到所需的web页面
public static string getwebInfo(string url)
{
string em="";
try
{
System.Net.HttpWebRequest hwr=(System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url);;
System.Net.HttpWebResponse res=(System.Net.HttpWebResponse)hwr.GetResponse();
System.IO.Stream st=res.GetResponseStream();
System.IO.StreamReader sr=new System.IO.StreamReader(st,System.Text.Encoding.Default);
//.........
em=sr.ReadToEnd();
sr.Close();
}
catch
{
;
}
return em;
}
#endregion
#region 去除里面的<font >
public static string clearFontStr(string webStr)
{
string str1=webStr;
string tmpS="";
str1=str1.ToLower();
str1=str1.Replace("</font>","");
int len=str1.IndexOf("<font");
while(len!=-1)
{
tmpS+=str1.Substring(0,len);
str1=str1.Substring(len);
int len1=str1.IndexOf(">");
if(len1!=-1)
{
str1=str1.Substring(len1+1);
}
len=str1.IndexOf("<font");
}
tmpS+=str1;
//。。。。。。。。。。。。。。。
tmpS=tmpS.Replace("<em>","");
tmpS=tmpS.Replace("</em>","");
tmpS=tmpS.Replace("<strong>","");
tmpS=tmpS.Replace("</strong>","");
return tmpS;
}
#endregion
#region 去除里面的Span
public static string clearSpanStr(string tmpS)
{
string str1=tmpS.ToLower();
string retStr="";
str1=str1.Replace("</span>","");
int len=str1.IndexOf("<span");
while(len!=-1)
{
retStr+=str1.Substring(0,len);
str1=str1.Substring(len+4);
int len1=str1.IndexOf(">");
if(len1!=-1)
{
str1=str1.Substring(len1+1);
}
len=str1.IndexOf("<span");
}
retStr+=str1;
return retStr;
}
#endregion
#region 得到字符串中的email列表
public static string[] getEmailList(string strInfo)
{
string respHTML=strInfo;
string[] retStr=new string[2000];
string strRegex ="\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
System.Text.RegularExpressions.MatchCollection m;
System.Text.RegularExpressions.Regex r;
r=new System.Text.RegularExpressions.Regex(strRegex,System.Text.RegularExpressions.RegexOptions.IgnoreCase);
m=r.Matches(respHTML);
for(int i=0;i<m.Count&&i<2000;i++)
{
retStr[i]=m[i].Value;
}
return retStr;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -