性格決定命運,氣度影響格局
          posts - 20, comments - 18, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          一個String 到 Double 的例子

          Posted on 2007-07-28 16:59 尚愛軍 閱讀(190) 評論(0)  編輯  收藏

          public class StrToDou {
           public static void main(String[] args) {
            String s = "1,2;3,4,5;6,7,8";
            Double [][] d;
            
            String[] sFirst = s.split(";");
            
            d = new Double[sFirst.length][];
            
            for(int i=0; i<sFirst.length;i++) {
             
          //System.out.println(sFirst[i]);

             String [] sSecond = sFirst[i].split(",");
              d[i] = new Double[sSecond.length];
             for(int j=0; j<sSecond.length; j++) {
              
          //System.out.println(sSecond[j]);

               d[i][j] = Double.parseDouble(sSecond[j]);
              
             }
            }
            
            for(int i=0; i<d.length; i++) {
             for(int j=0;j<d[i].length;j++) {
              System.out.print(d[i][j] + " ");
             }
             System.out.println();
            }
           } 
          }



          第一個小程序,作為一個開門紅?。?!

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 那曲县| 阳江市| 新宾| 淮南市| 河源市| 鄂伦春自治旗| 长泰县| 来凤县| 宜君县| 时尚| 行唐县| 江阴市| 云和县| 新丰县| 罗定市| 江陵县| 诸暨市| 沧源| 绥德县| 开封市| 乐清市| 巴青县| 武夷山市| 和田县| 临高县| 罗山县| 彭水| 宾川县| 新田县| 河曲县| 陆丰市| 大荔县| 开化县| 岗巴县| 大名县| 张家港市| 大余县| 舒城县| 青田县| 资溪县| 新化县|