怎么替换下面的字符串,
把121-dd-232,变成121dd232

解决方案 »

  1.   


    string a="121-dd-232";
    a.Replace("-","");
      

  2.   

    .......错了string a="121-dd-232";
    string b = a.Replace("-","");// b就是121dd232如果你想直接替换,可以:
    string a="121-dd-232";
    a = a.Replace("-","");
      

  3.   

    呵呵1楼的a还是没变
    string a = "121-dd-232".Replace("-","");
      

  4.   


    改一下就是了:
    a.Replace("-",""); 改成: a = a.Replace("-","");
      

  5.   

    string a="121-dd-232";
    a = a.Replace("-","");
      

  6.   


    string str = "121-dd-232";
    char[] trimChars = {'-'};
    str.Trim(trimChars);
      

  7.   

    刚学C#,试了一下,我的VS2008怎么没有Replace();
    系统提示:错误 1 “System.Array”不包含“Replace”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“Replace”(是否缺少 using 指令或程序集引用?) F:\VS2008练习\Clx\Clx1\Clx1\Program.cs 14 29 Clx1