首页 > 其他 > 详细

String--int互转

时间:2018-10-04 21:10:45      阅读:154      评论:0      收藏:0      [点我收藏+]

A:int -->String

1.String s1 = "" + 100;

2.String s2 = String.valueof(100);

3.(int -- Integer -- String)

Integer i = new Integer(100);

 String s3 = i.toString();

4.String s4 = Integer.toString(100);

B:String --> int

String s = "100";

1.(String -- Integer -- int)

Integer it = new Integer(s);

int i1 = it.intValue();

2.int i2 = Integer.parseInt(s);

String--int互转

原文:https://www.cnblogs.com/ayeex/p/9743343.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!