Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp.net»ñÈ¡img±êÇ©

public string GetFirstImg(string str)
{
//¼ÙÉèstrµÄֵΪ£º <p>dfsgdgdfgdgdf <img width="200" height="150" alt="" src="/upfile/image/Desert.jpg" /> </p>
// <p>dfdfgdfgdgdfgdg <img width="200" height="150" alt="" src="/upfile/image/Tulips.jpg" />dfgdfgdfgdgd </p>

//ÒªÇ󷵻صÚÒ»ÕÅͼƬµÄsrcÊôÐÔ£¬ÉÏÃæÄǸöÓ¦¸ÃÊÇ /upfile/image/Desert.jpg
}

¸øimg¼Ó¸öid,È»ºódocument.getElementById("imgid").src

»òÕßÓÃÕýÔò½ØÈ¡

System.Text.RegularExpressions.Regex  reg=new  System.Text.RegularExpressions.Regex(@" <img[^>].*?src=""(? <src>[^""].*)""[^>].*?>",System.Text.RegularExpressions.RegexOptions.IgnoreCase); 
System.Text.RegularExpressions.MatchCollection mc = reg.Matches(str);
for (int i = 0; i < m.Count; i++)
{
    Console.Write(m[i].Groups["src"].ToString());
}

List <string> lst= new List <string>();
Regex reg = new Regex(@" <img\s+[^>]*\s*src\s*=\s*(['""]?)(? <url>.+)['""]?[*>",RegexOptions.IgnoreCase);
MatchCollection mc = reg.Matches("");
foreach(Match m in mc)
{
    lst.Add(m.Groups["src"].Value);
}

{{---


Ïà¹ØÎÊ´ð£º

Windows¿Ø¼þÓ¦ÓÃÓÚASP.netµÄȨÏÞÎÊÌâ

ÎÒÒѽ«Windows¿Ø¼þ³É¹¦Ó¦ÓÃÓÚAsp.netÖУ¬µ«Õâ¸ö¿Ø¼þ»¹Òª·ÃÎÊÊý¾Ý¿â¡¢½øÐб¾µØIO²Ù×÷¡¢´òÓ¡µÈ£¬Õâʱ¾Í»á³öÏÖ¡°Ó¦ÓóÌÐòÊÔͼִÐа²È«²ßÂÔ²»ÔÊÐíµÄ²Ù×÷¡±ÕâÑùµÄÌáʾ£¬Ó¦¸ÃÔõÑù¸øËüÊÚȨ£¿

ÔÚ¿Í»§¶ËÒªÅäÖÃ,ÔÊÐí¿Í»§¶ËÈ ......

asp.netÖеÄGridViewÎÊÌâ

ÎÒÔÚ Page_Load ÀïдÁË
if(!IsPostBack){
  GridView1.DataSource=GroupManager.GetGroups();//GetGroups ·µ»ØµÄÊÇ IList<Group>
  GridView1.DataBind();
}
¿ÉÎÒÔÚ Submit_Click Àïд´ú ......

ÈçºÎÉú³ÉASCII¸ñʽÎļþ asp.net

rt  ÎÒÉú³ÉµÄÎļþµÄ±£´æ¶¼ÊÇutf-8 ÈçºÎÄÜÊÖ¶¯¿ØÖƳÉASCII


System.IO.File.WriteAllText(@"c:\a.txt", "hello", Encoding.ASCII);

ÄÇÊ×ÏÈ¿´Äã¶Á½øÀ´µÄÎļþÊǸöʲô±àÂë¸ñʽ,Èç¹ ......

ASP.NET

ASP.NET ´íÎó ÎÞ·¨Ê¶±ðµÄ±ê¼Çǰ׺»òÉ豸ɸѡÆ÷¡°asp¡± 

´úÂëÈçÏ£º

<%@ Page Language="C#" ContentType="text/xml" AutoEventWireup="true" CodeFile=" ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ