function changecode(str as string)
if len(str)>0 then
   str = Replace(str, CHR(32), " ")
   str = Replace(str, CHR(9), " ")
   str = Replace(str, CHR(34), """)
   str = Replace(str, CHR(39), "'")
   str = Replace(str, CHR(13), "")
   str = Replace(str, CHR(10) & CHR(10), "</P><P>")
   str = Replace(str, CHR(10), "<BR> ")
   str=replace(str,"","'>")
   str=replace(str,"","<b>")
   str=replace(str,"","</b>")
   str=replace(str,"[em]","<em>")
   str=replace(str,"[/em]","</em>")
   str=replace(str,"","<u>")
   str=replace(str,"
","</u>")
   str=replace(str,"[center]","<center>")
   str=replace(str,"[/center]","</center>")
   str=replace(str,"[mail]","<a href='mailto:")
   str=replace(str,"[url]","<a href='")
   str=replace(str,"[|mail]","'>")
   str=replace(str,"[|url]","'>")
   str=replace(str,"[/hyper]","</a>")
   str=replace(str,"[upimg]","<img src=upload/")
   str=replace(str,"[/upimg]",">")
   part1=left(str,instr(str,">"))
   part2=right(str,(len(str)-instr(str,">")))
  
   str=part1+part2
   return str
end if
end function

解决方案 »

  1.   

    object changecode(string str)
    {
     if (len(str) > 0) {
       str = Replace(str, CHR(32), " ");
       str = Replace(str, CHR(9), "&nbsp;");
       str = Replace(str, CHR(34), "&quot;");
       str = Replace(str, CHR(39), "&#39;");
       str = Replace(str, CHR(13), "");
       str = Replace(str, CHR(10) + CHR(10), "</P><P>");
       str = Replace(str, CHR(10), "<BR> ");
       str = replace(str, "", "'>");
       str = replace(str, "", "<b>");
       str = replace(str, "", "</b>");
       str = replace(str, "[em]", "<em>");
       str = replace(str, "[/em]", "</em>");
       str = replace(str, "", "<u>");
       str = replace(str, "
    ", "</u>");
       str = replace(str, "[center]", "<center>");
       str = replace(str, "[/center]", "</center>");
       str = replace(str, "[mail]", "<a href='mailto:");
       str = replace(str, "[url]", "<a href='");
       str = replace(str, "[|mail]", "'>");
       str = replace(str, "[|url]", "'>");
       str = replace(str, "[/hyper]", "</a>");
       str = replace(str, "[upimg]", "<img src=upload/");
       str = replace(str, "[/upimg]", ">");
       part1 = left(str, instr(str, ">"));
       part2 = right(str, (len(str) - instr(str, ">")));
       str = part1 + part2;
       return str;
     }
    }
      

  2.   

    大网上找个vb.net to C#的转换程序,一般老外写的转换器不错
      

  3.   

    public static string ChangeCode(string str)
    {
    string lcRetVal = str;
    if (str!=null&&str.Trim().Length>0)
    {
    str = str.Replace( CHR(32), " ");
    str = str.Replace( "[/upimg]", ">");
    return str;
    }
    return lcRetVal;
    }
      

  4.   

    part1=left(str,instr(str,">"))
       part2=right(str,(len(str)-instr(str,">")))请问这两句这么翻译