字串 String 轉換成整數 int

A. 有兩個方法: 



1). int i = Integer.parseInt([String]); 或 

i = Integer.parseInt([String],[int radix]); 



2). int i = Integer.valueOf(my_str).intValue(); 




整數 int 轉換成字串 String

A. 有三種方法: 



1.) String s = String.valueOf(i); 



2.) String s = Integer.toString(i); 



3.) String s = "" + i; 



注: Double, Float, Long 轉成字串的方法大同小異. 

arrow
arrow
    全站熱搜

    Frank 發表在 痞客邦 留言(1) 人氣()