Expand String to Double.NaN

I want users to edit a field with duplicate data. I want to enable Double.NaN(for void values). Is there a general way (predefined string) that is parsed Double.NaNfrom out of a method Double.valueOf(String)without checking it in the background?

There is a special char, similar to a diamond with a question mark in it (in HTML), which acts like NaN, but - well - users will not find it on their keys.

+5
source share
2 answers

You can transfer +NaNeither -NaNor NaNto valueOf()and return it to NaN. The documentation provides complete information.

+8
source

parseDouble("NaN")will return the value NaN:

System.out.println(Double.isNaN(Double.parseDouble("NaN"));
+1

All Articles