隨筆-9  評論-168  文章-266  trackbacks-0

           如何將字串 String 轉換成整數 int?
          int i = Integer.valueOf(my_str).intValue();

          int i=Integer.parseInt(str);

          如何將字串 String 轉換成Integer ?
          Integer integer=Integer.valueOf(str);

          如何將整數 int 轉換成字串 String ?
          1.) String s = String.valueOf(i);
           
          2.) String s = Integer.toString(i);
           
          3.) String s = "" + i;

          如何將整數 int 轉換成Integer ?
          Integer integer=new Integer(i);

          如何將Integer 轉換成字串 String ?
          Integer integer=String

          如何將Integer 轉換成 int ?
          int num=Integer.intValue();

          如何將String轉換成  BigDecimal  ?
           BigDecimal d_id = new BigDecimal(str);


          如何將 String 轉換成 char ?
          char[] ca="123".toCharArray();

          如何將char轉換成String?
          String s=ca.toString();      //任何類型都可以采用toString()轉換成String類型

          //-----------------日期-------------------------

          Calendar calendar=Calendar.getInstance();
            int year=calendar.get(Calendar.YEAR);
            int month=calendar.get(Calendar.MONTH)+1;
            int day=calendar.get(Calendar.DATE);

          獲取今天的日期字符串
          String today=java.text.DateFormat.getDateInstance().format(new java.util.Date());
          獲取今天的日期
          new java.sql.Date(System.currentTimeMillis())

          posted on 2008-09-09 14:18 紫蝶∏飛揚↗ 閱讀(4422) 評論(1)  編輯  收藏 所屬分類: JSFSpringStruts1/2Hibernate重點數據轉換

          評論:
          # Internet Marketing 2009-05-18 12:51 | Internet Marketing
          Hi all. The great art of giving consists in this: the gift should cost very little and yet be greatly coveted, so that it may be the more highly appreciated.
          I am from Portugal and also now'm speaking English, give true I wrote the following sentence: "Com tips on how to do keyword research for search engine optimization to help ensure your site ranks well in search engines like google.Alexa rank and page rank provided by alexa."

          With love 8-), Red.  回復  更多評論
            
          主站蜘蛛池模板: 昂仁县| 曲水县| 正镶白旗| 长乐市| 五常市| 巴马| 民县| 桐城市| 大新县| 清苑县| 章丘市| 莆田市| 扬中市| 松阳县| 林口县| 宽甸| 石嘴山市| 白河县| 武宣县| 大丰市| 家居| 休宁县| 石嘴山市| 绿春县| 榆树市| 离岛区| 南康市| 白银市| 湘乡市| 云林县| 安阳市| 通海县| 西乌| 鹿泉市| 禹州市| 黔江区| 时尚| 保德县| 连云港市| 远安县| 新泰市|