Is there a quick and easy way to convert a String (received using the Edit.getText() function) to an int, or does the conversion have to be done manually?
You can use the Integer class to convert a String (containing digits only) to an Integer object. You can then get the primitive int value from the Integer object, e.g: String s = "1234"; Integer intObject = new Integer(s); int i = intObject.intValue(); [This message has been edited by Thomas Berglund (edited May 14, 2001).]
Integer stringValue = new Integer(Repeat.getText()); Repeat is an edit box.
Richard Robbins
Ranch Hand
Joined: Mar 07, 2001
Posts: 66
posted
0
I solved the problem. I was using the name of my label (Repeat) rather than the name of the actual edit box (Number), so I was passing the String "Repeat" as a paramater to a new Integer.