现在的位置: 首页 > 综合 > 正文

java中的String 与 int 的转换

2019年08月14日 ⁄ 综合 ⁄ 共 235字 ⁄ 字号 评论关闭

一、如何将整数String转换成字串int?

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

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

二、如何将整数int转换成字串String?

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

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

3、String s = "" + i;
 

抱歉!评论已关闭.