简体   繁体   English

将Int转换为String值

[英]Conversion of an Int to String value

If I want to convert a int to string and my code is 如果我想将int转换为字符串,并且我的代码是

   database.setMinConnectionsPerPartition
   (dbPoolElement.getAttribute("ConPoolminConnections"));

Am I right in using (String.valueOf to convert it from int to string? 我使用(String.valueOf将其从int转换为string吗?

String.valueOf(number)

Integer.toString(number)

those are two I can think of now, that will return String value of int 那是我现在能想到的两个,它将返回int的String值

你也可以隐式地做

String s = myInt+"";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM