|
Author |
Topic: convert integer into string (Read 14484 times) |
|
bren
|
convert integer into string
« on: Aug 15th, 2003, 11:45am » |
|
Can someone tell me the method to convert an integer into a string: for instance to display the hours and minutes using the text() method. Cheers.
|
|
|
|
mKoser
|
Re: convert integer into string
« Reply #1 on: Aug 15th, 2003, 12:22pm » |
|
you can do it like this: Code: int num = 9; String str = Integer.toString(num); |
| or as a working example in Proce55ing: Code: int num = 9; String str; void setup(){ } void mousePressed(){ str = Integer.toString(num); println(str); } |
| - Mikkel
|
« Last Edit: Aug 15th, 2003, 12:24pm by mKoser » |
|
mikkel crone koser | www.beyondthree.com | http://processing.beyondthree.com
|
|
|
youhou
|
Re: convert integer into string
« Reply #2 on: Aug 15th, 2003, 1:10pm » |
|
i guess this should work too : int iMyInt = 125; string strMyInt = ""+ iMyInt; can also be used directly println(""+ iMyint);
|
|
|
|
bren
|
Re: convert integer into string
« Reply #3 on: Aug 15th, 2003, 3:45pm » |
|
that's great thanks
|
|
|
|
|