应该是替换为:<IMG SRC="http://192.168.1.57/zgjt/文件名.jpg border=0>

解决方案 »

  1.   

    who can help me??
      

  2.   

    string fileName="**文件名**";
    string s=fileName.Replace("**","");
    string source=fileName.Replace("**"+s,"<IMG SRC="http://192.168.1.57/zgjt/"+s).Replace(s+"**",s+".jpg border=0>");
      

  3.   

    SRC="http://192.168.1.57/zgjt/中的"换为'
      

  4.   

    // 前提,你需要保证第一个文件名以**开头,不然,就乱了
    CString sFiles = _T("**file1.jpg** fdasd**file2.jpg**3123 **file3.jpg** -=-=**file4.jpg** =-0-=0**file5.jpg** "); int nStart=0, nEnd=0;
    while (nStart != -1) {
    nStart = sFiles.Find(_T("**"), nEnd);
    if (nStart != -1) {
    nEnd = sFiles.Find(_T("**"), nStart+2);
    if (nEnd != -1) {
    CString s = sFiles.Mid(nStart+2, nEnd-(nStart+2));
    TRACE("<IMG SRC=\"http://192.168.1.57/zgjt/%s\" border=0>\r\n", s);
    nEnd += 2;
    }
    else{
    break;
    }
    }
    }
    Debug output 
    <IMG SRC="http://192.168.1.57/zgjt/file1.jpg" border=0>
    <IMG SRC="http://192.168.1.57/zgjt/file2.jpg" border=0>
    <IMG SRC="http://192.168.1.57/zgjt/file3.jpg" border=0>
    <IMG SRC="http://192.168.1.57/zgjt/file4.jpg" border=0>
    <IMG SRC="http://192.168.1.57/zgjt/file5.jpg" border=0>
      

  5.   

    好像要C#哦?
    String sFiles = "**file1.jpg** fdasd**file2.jpg**3123 **file3.jpg** -=-=**file4.jpg** =-0-=0**file5.jpg** "; int nStart=0, nEnd=0;
    while (nStart != -1) {
    nStart = sFiles.IndexOf("**", nEnd);
    if (nStart != -1) {
    nEnd = sFiles.IndexOf("**", nStart+2);
    if (nEnd != -1) {
    String s = sFiles.SubString(nStart+2, nEnd-(nStart+2));
    String sYouHtmlValue = String.Format("<IMG SRC=\"http://192.168.1.57/zgjt/{0}\" border=0>\r\n", s);
    nEnd += 2;
    }
    else{
    break;
    }
    }
    }
      

  6.   

    最好你能研究一下这样一串的**文件名**的规律,字符串中应该有分割符或者什么类似的东西啊。也可以贴出来大家一起看看,然后用STRING的类就应该能解决问题。
    如果不熟悉STRING类可以收索MSDN的“STRING类”一看就明白的。
      

  7.   

    可以使用indexof()方法实现:
    int pos=-2;
    //txt_file就是那个含有文件名的字符串
    String content=this.textBox1.Text; //先替换一个
    if(content.IndexOf("**")!=-1)
    {
    pos=content.IndexOf("**");
    content=content.Remove(pos,2);
    content=content.Insert(pos,"<IMG SRC='http://192.168.1.57/zgjt/");
       

    //再替换其他的
    if(content.IndexOf("****")!=-1)
    {
    while(content.IndexOf("****")!=-1)
    {
    pos=content.IndexOf("****");
    content=content.Remove(pos,4);
    content=content.Insert(pos," border=0'><IMG SRC='http://192.168.1.57/zgjt/");
    }
    }
    if(content.IndexOf("**")!=-1)
    {
    pos=content.IndexOf("**");
    content=content.Remove(pos,2);
    content=content.Insert(pos," border=0'>");
    }

    }
      

  8.   

    输入为:
    **1.jpg****2.jpg****3.jpg**
      

  9.   

    这里用**pic(单纯的名字,无扩展名,因为全部图片为jpg格式)** 来标记读指定的一个目录下的pic.jpg图片。
    由于考虑到**pic**很容易乱。这个[**]pic[/**]都比它好,至少乱的可能性小了很多。
    没办法。别人VC里这样写的。我必须用的它的数据。郁闷!
    刚才突然想到了正则表达式。
    小试,好象也能用:string mystr="**20030324T801**正文1**20030324T801**正文2**20030324T801**";
    mystr=mystr.Replace("**","[**]");
    string chr = Regex.Replace(mystr,@"\[\*\*\](?<x>[^\]]*)\[\*\*\]",@"<img src=image/t/$1.jpg></i>",RegexOptions.IgnoreCase);
    Response.Write(chr);我这里用一句话,就搞定了。
    不知道,这样处理会不会有问题。
    请大家指教。想不到一会有这么多回复。谢谢大家。
    我开始也想用IndexOf来操作,上面的代码还没时间研究。相互学习,共同进步!
      

  10.   

    上面好象多了一个</i>去了应该没问题了。