<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Dedian  
    -- 關(guān)注搜索引擎的開發(fā)
    日歷
    <2006年4月>
    2627282930311
    2345678
    9101112131415
    16171819202122
    23242526272829
    30123456
    統(tǒng)計
    • 隨筆 - 82
    • 文章 - 2
    • 評論 - 228
    • 引用 - 0

    導(dǎo)航

    常用鏈接

    留言簿(8)

    隨筆分類(45)

    隨筆檔案(82)

    文章檔案(2)

    Java Spaces

    搜索

    •  

    積分與排名

    • 積分 - 65500
    • 排名 - 816

    最新評論

    閱讀排行榜

    評論排行榜

     
    It is common problem of convertion between int & string for certian computer language. Well, in Java, following are some easy ways I usually apply:

    1. int --> String
    ??? a. apply "+" operation with an empty string
    ??? ?? ?? ex:
    ??? ?? ?? int index = 20;
    ??? ?? ?? String indexStr = "" + index;
    ??? b. use String function
    ??? ?? ?? ex:
    ??? ?? ?? int index = 20;
    ??? ?? ?? String indexStr = String.valueOf(index);
    ??? c. convert to Integer class firstly
    ??? ?? ?? ex:
    ??? ?? ?? int index = 20;
    ??? ?? ?? Integer Index = new Integer(index);
    ??? ?? ?? String indexStr = Index.toString();
    ??? ?? ?? or
    ??? ?? ?? String indexStr = Integer.toString(index);

    2. String --> int
    ??? a. use class Integer parse funtion
    ??? ?? ex:
    ??? ?? String indexStr = "20";
    ??? ?? int index = Integer.parseInt(indexStr);
    ??? ?? or
    ??? ?? int index = (new Integer(indexStr)).intValue();

    note: above convertion methods can be applied to other number types, such as float, long, double...

    P.S. for 1.a method, should be noticed that following two expression are different:
    int i = 7;
    int j = 8;

    String str1 = i + j + ""; //(str1 == "15")
    String str2 = "" + i + j; //(str2 == "78")
    ?
    posted on 2006-04-25 09:22 Dedian 閱讀(734) 評論(0)  編輯  收藏 所屬分類: Java Memo
     
    Copyright © Dedian Powered by: 博客園 模板提供:滬江博客
    主站蜘蛛池模板: 亚洲 无码 在线 专区| 中文字幕亚洲免费无线观看日本 | 久久国产精品亚洲综合| 2022久久国产精品免费热麻豆| 亚洲中文字幕无码一去台湾| 国产99久久亚洲综合精品| 国产亚洲精久久久久久无码77777| 57pao国产成视频免费播放| 日韩成人精品日本亚洲| 亚洲AV无码一区二区二三区软件 | 亚洲性久久久影院| 69堂人成无码免费视频果冻传媒 | free哆拍拍免费永久视频| 亚洲精品视频观看| 亚洲国产专区一区| 免费视频专区一国产盗摄| 精品一区二区三区免费视频 | 中文字幕成人免费高清在线视频| 亚洲视频一区二区三区| 亚洲一区无码精品色| 在线免费一区二区| 99精品视频免费观看| 免费在线观看自拍性爱视频| 亚洲国产精品久久人人爱| 精品国产香蕉伊思人在线在线亚洲一区二区 | 亚洲成人动漫在线观看| 国产亚洲美女精品久久久| 成年性午夜免费视频网站不卡| 免费精品久久天干天干| 日韩精品免费一线在线观看| 亚洲AV日韩综合一区尤物| 在线观看亚洲人成网站| 国产亚洲婷婷香蕉久久精品 | 亚洲国产精品专区在线观看| 亚洲人成电影网站免费| 免费A级毛片av无码| 中文字幕免费在线看| 免费人成大片在线观看播放电影| 亚洲色欲啪啪久久WWW综合网| 337p日本欧洲亚洲大胆色噜噜| 日本亚洲国产一区二区三区|