1

Hello ive got some problem with my program. I try to reading lines from file ,split them to each variable. But this file have different types of double like:

  • 10000,20
  • 4000,10
  • 5,400.20

and when i trying to parse strings to double ive got exception:

java.lang.NumberFormatException: For input string: "10000,20"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
TjDillashaw
  • 787
  • 1
  • 12
  • 29

1 Answers1

0

Problem with comma(,) in "10000,20" so remove comma and try

 Double.parseDouble("10000,20".replace(",", ""))
Sasikumar Murugesan
  • 4,412
  • 10
  • 51
  • 74
  • Thank you for answer, but here is better solution http://stackoverflow.com/questions/888088/how-do-i-convert-a-string-to-double-in-java-using-a-specific-locale – TjDillashaw Jun 04 '15 at 06:38