比如一个字符串12345.8745
我要截取12345 还有8745 这个怎么办

解决方案 »

  1.   


     string s = "12345.8745";
     string[] str = s.Split('.');
      

  2.   

    string s = "12345.8745";
    string ss = s.Split('.');
    然后ss[0]就是12345
    ss[1]是8745
      

  3.   

    string s = "12345.8745";
    string[] out = s.Split('.');
      

  4.   

    少打了中括号
    string s = "12345.8745";
    string[] ss = s.Split('.');
    然后ss[0]就是12345
    ss[1]是8745
      

  5.   

    String的substring()方法就可以截取字符串,
    第一种是:String substring(int startIndex)
    第二种是:String substring(int startIndex,int endIndex) //startIndex  指开始字符串的下标。endIndex  结束字符串的下标。
      

  6.   

    string s = "12345.8745";
    string[] ss = s.Split('.');
    ss[0]="12345";
    ss[1]="8745";