problem with parseDouble numberformatexception...
Hey! I'm trying to convert a value in a string to a double value, but I get the NumberFormatException...
tempString = readerStrings.get(i);
tempString.substring(tempString.lastIndexOf("=")+1);
tempDbl = Double.parseDouble(tempString);
here's the error
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "period=360.0"
as you can see, the tempString when it is read from readerStrings is period=360.0. then i make the string only 360.0 and then I convert it to a double variable. I don't know why I'm getting this error as it looks fine to me. Please help! Thanks!
Look at your line:
tempString.substring(tempString.lastIndexOf("=")+1);
Does it do anything to tempString? Look at the String API subString method? Does it mutate the String that calls it? or does it rather return a result? hmmmmmmm
Also look at your error message, is it being passed your expected truncated string? hmmmmmm again.
You're close, but not there.
Addendum: too slow again!!
Message was edited by:
petes1234
> Yes, but I bow to your superior Socratic rigor, even
> the moment of beard twirling when you say "hmmm..."
LOL. At least we both agreed on the error. That means that we can't be right.
Besides, I thought that you'd be too busy w/ beatjunkie to answer any other questions on the forum. Guess not.
Message was edited by:
petes1234