Topic: 请问如何把 INT 转换成 String ??? |
Print this page |
1.请问如何把 INT 转换成 String ??? | Copy to clipboard |
Posted by: PANDORA Posted on: 2003-03-10 13:49 例如 int text=123; String ttt; ttt=text; (这段语句是通不过的) |
2.Re:请问如何把 INT 转换成 String ??? [Re: PANDORA] | Copy to clipboard |
Posted by: itfirst Posted on: 2003-03-10 14:29 改成 String ttt=String.parseString(text); |
3.Re:请问如何把 INT 转换成 String ??? [Re: PANDORA] | Copy to clipboard |
Posted by: Tormz Posted on: 2003-03-10 15:12 you can write like this as well. int text=123; String ttt=Intger.toString(123); |
4.Re:请问如何把 INT 转换成 String ??? [Re: PANDORA] | Copy to clipboard |
Posted by: lindentree Posted on: 2003-03-10 16:03 可以这么写: int text=123; String ttt; ttt=""+text; |
5.Re:请问如何把 INT 转换成 String ??? [Re: itfirst] | Copy to clipboard |
Posted by: cmslovehxh Posted on: 2003-03-10 16:03 itfirst wrote: |
6.Re:请问如何把 INT 转换成 String ??? [Re: cmslovehxh] | Copy to clipboard |
Posted by: cmslovehxh Posted on: 2003-03-10 16:06 int text=123; String ttt=Integer.toString(text); or ttt=""+text; |
7.Re:请问如何把 INT 转换成 String ??? [Re: cmslovehxh] | Copy to clipboard |
Posted by: gunrose Posted on: 2003-03-12 10:12 使用String stringValue=String.valueOf(intValue); 另外,个人不建议使用+的方式,我觉得那不是正确的解决方法,容易有误解,而且性能也不行 /** * Returns the string representation of the <code>int</code> argument. * <p> * The representation is exactly the one returned by the * <code>Integer.toString</code> method of one argument. * * @param i an <code>int</code>. * @return a string representation of the <code>int</code> argument. * @see java.lang.Integer#toString(int, int) */ public static String valueOf(int i) { return Integer.toString(i, 10); } |
8.Re:请问如何把 INT 转换成 String ??? [Re: PANDORA] | Copy to clipboard |
Posted by: software_young Posted on: 2003-03-18 00:18 可以使用Integer.parseInt(text) |
9.Re:请问如何把 INT 转换成 String ??? [Re: PANDORA] | Copy to clipboard |
Posted by: redfox Posted on: 2003-03-18 13:51 可以用String的一个函数,自己查文当了 |
10.Re:请问如何把 INT 转换成 String ??? [Re: PANDORA] | Copy to clipboard |
Posted by: xiaopan Posted on: 2003-03-18 14:40 由于+号在JAVA中不但是算术运算符号,也是字符串连接符号;这个概念叫做运算符重载。所以123+“”是可行的,实际上由于+两边类型不同,先把int型转换成STIING型,然后连接变成“123”给ttt |
11.Re:请问如何把 INT 转换成 String ??? [Re: PANDORA] | Copy to clipboard |
Posted by: jackycct Posted on: 2003-03-19 10:29 String stringValue=String.valueOf(intValue); This should be the formal way |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |