0

how to check wheather the variable containing double value or empty

?? i am getting response from web services which i have stored in 3 different different variable say for example

var1=some double value var2= some double value and var 3=some double value

now how to check var1,var2 and var3 wheather they really contain double value or integer value ??? this is my question

Thanks in advance

user701735
  • 145
  • 1
  • 5
  • 13
  • Please Clarify your question and place some relevant code so It'll be easier for us to help you. – Jaydeep Khamar May 02 '11 at 13:47
  • Please add some clarification: Do you have a string and you want to know if the string contains a valid double such as 2.56? Or, do you have a list and you want to know if it has duplicates values? – Sarel Botha May 02 '11 at 13:48

1 Answers1

1

Try this:

Double d = 1.2;
if(Double.compare(d,Double.NaN)==0) {
  Log.i("TEST", "Double is NaN");
} else {
  Log.i("TEST", "Double is not NaN");
}
straya
  • 5,002
  • 1
  • 28
  • 35