NumberFormatException when converting a String to a double

21 views
Skip to first unread message

cubiq1

unread,
Sep 5, 2014, 6:29:02 AM9/5/14
to codenameone...@googlegroups.com
Hi,

I get a NumberFormatException ("Input string was not in a correct format") when trying to convert a String to a double on Windows Phone. Other platforms work fine.

I've tried using both Double.parseDouble() and Double.valueOf() but both throw up the exception. The issue only occurs on actual Windows Phone hardware and not in the CN1 simulator.

Is there a fix for this?

Many thanks

Shai Almog

unread,
Sep 5, 2014, 11:35:58 AM9/5/14
to codenameone...@googlegroups.com
Hi,
this should work. I explicitly recall dealing with this myself.
Is this for any number or just for specific input types?

cubiq1

unread,
Sep 5, 2014, 12:57:45 PM9/5/14
to codenameone...@googlegroups.com
Hi,

I only tried converting the Strings "1.0" and "1.1" to double, so can't really comment but I assume other numbers will also throw the same exception.

I would try more test cases but WP builds do take some time.

Should I file an issue for this?

Thanks

Shai Almog

unread,
Sep 6, 2014, 3:18:27 AM9/6/14
to codenameone...@googlegroups.com
Hi,
can you file an issue. We'll try to look at it once things cool down a bit.

cubiq1

unread,
Sep 6, 2014, 6:54:33 AM9/6/14
to codenameone...@googlegroups.com
Hi,

Filled Issue 1177.

Thanks!
Reply all
Reply to author
Forward
0 new messages