string aa="http://aaa.jpghttp://bbb.jpghttp://ccc.jpghttp://ddd.jpg";
splitaa(aa);如何让他返回
如下的数组http://aaa.jpg
http://bbb.jpg
http://ccc.jpg
http://ddd.jpgsplitaa这个函数怎么写啊,请教

解决方案 »

  1.   

    突然来了灵感解决了private void splitaa(string aa)
    {      aa=aa.Replace("http://","|http://");
          string [] split = aa.Split('|');      foreach (string s in split) 
          {
    if (s.Trim() != "")
    MessageBox.Show(s);
          }
    }
      

  2.   

    string aa="http://aaa.jpghttp://bbb.jpghttp://ccc.jpghttp://ddd.jpg";
    System.Text.RegularExpressions.Regex r=new System.Text.RegularExpressions.Regex ("http://\\w+\\.jpg");
    System.Text.RegularExpressions.MatchCollection matchs=r.Matches(aa);
    string[] values=new string [matchs.Count];
    for(int i=0;i<matchs.Count;i++)
    {
    values[i]=matchs[i].Value;
    }foreach(string s in values)
    {
    Response.Write(s+"<br>");
    }