问题如下:
  string name = "abcdefg (KB936123)"
想截取到括号内 KB936123 字符串中值怎么办?
  谢谢给位大侠指导,刚刚注册账号没什么分值给大家。

解决方案 »

  1.   


    string strTest = url;
    int startIndex = strTest.LastIndexOf("(") + 1;
    int length = strTest.Length - strTest.IndexOf(")");
    return strTest.Substring(startIndex, strTest.Length - length - startIndex);
    瞎写的
      

  2.   

    我说的不太准确,string name=sub(....);
      

  3.   

    http://msdn.microsoft.com/zh-cn/library/ms256054(VS.80).aspx"1234",到"23"
    string name=substring("1234",2,2);
    第一个参数:字符串
    第二个参数:从第几位开始(0起)
    第三个参数:取几位
      

  4.   


        string name = "abcdefg (KB936123)";
        name = name.Substring(name.IndexOf("(") + 1, name.Length - 2 - name.IndexOf("("));
    这是最笨的方法