Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get the Next Double from a String

807599Feb 4 2007 — edited Feb 4 2007
I have used a Scanner Object before to read doubles from an input, but how do I get the Next double from a String?

Used this in the past:
Scanner input = new Scanner(System.in);
double num = input.nextDouble();
I am looking for something like this:
String example = "100.00Degrees";
double num = example.nextDouble();
// num now equals 100.00
Any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2007
Added on Feb 4 2007
2 comments
135 views