Click to See Complete Forum and Search --> : convert integer to string
AlnavPlatinum
Sep 22nd, 2006, 07:45 PM
In java, how do you convert an integer to a string?
1 = '1'
Thanks
ComputerJy
Sep 22nd, 2006, 10:16 PM
int value=5;
String str=Integer.toString(value);
eranga262154
Sep 23rd, 2006, 12:31 AM
I alwys used following as ComputerJy used,
int int_value=100;
String string_value=Integer.toString(int_value);
CornedBee
Sep 23rd, 2006, 07:19 PM
> String str=""+5;
Not a good idea. This creates a temporary StringBuilder.
ComputerJy
Sep 23rd, 2006, 07:25 PM
> String str=""+5;
Not a good idea. This creates a temporary StringBuilder.
Yeah I know, but there are people who still do it that way
System_Error
Sep 23rd, 2006, 07:45 PM
Yeah I know, but there are people who still do it that way
Like me, but being lazy is my excuse.
CornedBee
Sep 23rd, 2006, 09:07 PM
Yeah I know, but there are people who still do it that way
All the more reason not to show new people this approach, or say that it's not good, no?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.