alias
Double.Parse(String) (C#)
alias lang_id
csharp
how to
convert string to float
lang_id
java
qid
28004

How to
Double.Parse(String) (C#) in Java

Redirected to “convert string to float

Double

Use Double.parseDouble static method.

double Double.parseDouble(String s);
  • If it failed, NumberFormatException is thrown.

Example:

double x = Double.parseDouble("-3.14159");

Float

Use Float.parseFloat static method.

float Float.parseFloat(String s);
  • If it failed, NumberFormatException is thrown.

Example:

float x = Float.parseFloat("-3.14159");
Select default language: