We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
String to Int? (Read 270 times)
String to Int?
Nov 7th, 2008, 10:40am
 
Hello,

first I created a StringBuffer to type and delete text into it.
Then i converted it into an String (because I need to display it on the screen).
I only use numbers no letters in my Strings
Now I need to convert the String into an int value to use to for drawing.

stringx = stringbufferx.toString();
   int_value = Integer.parseInt(stringx);

When using this script in my application and I type e.g. "18000" I get an error named:

java.lang.NumberFormatException: For input string: "180

Any suggestions what might be wrong?

Re: String to Int?
Reply #1 - Nov 7th, 2008, 5:21pm
 
try:

int( "18000" );

http://processing.org/reference/int_.html

F
Page Index Toggle Pages: 1