string str = "\0\0\0\0\0\0\0\0";
小弟初学c# ,如何把字符串str转换到str1
string str1 = "00000000";注:Replace remove 我已经测试过不行。

解决方案 »

  1.   

                string str = "\0\0\0\0\0\0\0\0";
                string []strs =  str.Split(new char[] { '\\' });
                再用foreach读出
      

  2.   

    方法如下:
    String str1=str.Replace('\','');
      

  3.   

    str1 = str.Replace("\0","0");
      

  4.   

    string _str ="\0\0\0\0\0\0\0\0";
    string str = _str.Replace("\0","0");
    MessageBox.Show(str);
    完全正确
      

  5.   

    有\的根本就不算字符了,应该加@
                string str = @"\0\0\0\0\0\0\0\0";
                string str1 = str.Replace("\\","");
      

  6.   

      string str = "\0\0\0\0\0\0\0\0";
                Console.Write("\\");
                Console.Write(str);
                str = str.Replace("\0", "0");
                Console.Write(str);