如何把双引号去掉啊?

解决方案 »

  1.   

    string str = "\"try\"";
    string ret = str.Replace("\"", string.Empty);
      

  2.   

    string sourceString = "\"try\"";
    string pattern = "(?<=\\\")(\\w+)(?=\\\")";
    string result = System.Text.RegularExpressions.Regex.Replace(sourceString,pattern,@"$1");
    WL(result);//输出
      
    //////////////////////////////////////////////
    MSN:[email protected]请给我一个与您交流的机会!
      

  3.   

    string str = "\"try\"";
    string ret = str.Replace("\"", string.Empty);
    string ret = str.Replace("\"", "");
      

  4.   

    Sorry 刚才出了错,以下是正确方式: string sourceString = @"""\""try\""""";
    string pattern = @"\\""(?<name>\w*)\\""";
    string result = System.Text.RegularExpressions.Regex.Replace(sourceString,pattern,@"${name}");
    WL(result);//输出
      
    //////////////////////////////////////////////
    MSN:[email protected]请给我一个与您交流的机会!