用Split劈开一个字符串

类别:.NET开发 点击:0 评论:0 推荐:
  private string splitstr(string str)
 {
      string str = "xxxxxx[12345]";
       string[] a = str.Split('[');
       //a[0] = "xxxxxx";
       //a[1] = "12345]";
       if(a.Length >1)
       {
        string[] b = a[1].Split(']');
        return b[0];
       }
       else
       {
        string[] b = {""};
       return b[0];
      }  
  }

本文地址:http://com.8s8s.com/it/it42500.htm