In java, how do you convert an integer to a string?
1 = '1'
Thanks
Printable View
In java, how do you convert an integer to a string?
1 = '1'
Thanks
Code:int value=5;
String str=Integer.toString(value);
I alwys used following as ComputerJy used,
int int_value=100;
String string_value=Integer.toString(int_value);
> String str=""+5;
Not a good idea. This creates a temporary StringBuilder.
Yeah I know, but there are people who still do it that wayQuote:
Originally Posted by CornedBee
Like me, but being lazy is my excuse.Quote:
Originally Posted by ComputerJy
All the more reason not to show new people this approach, or say that it's not good, no?Quote:
Originally Posted by ComputerJy