The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

solution.............

Posted by Jody Brown on November 12, 2000 at 4:25 PM

Hi slim,

Simple solution..........

String myString = "123";

int myInt = (new Integer(myString)).intValue();

or

double myDouble = (new Integer(myString)).doubleValue();


Be aware that this will throw a NumberFormatException if the string cannot be represented as an Integer.

Hope this helps,

Jody



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us