Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Testing if variable holds a decimal point

$
0
0
value1 = txtDisplay.getText(); //value 1 declared as a double.
if(String.valueOf(value).contains(".")){

          //then do something.........

}






Hi there, just trying to find a way to test if a variable (value1) holds a decimal from user input.
This doesn't compile, just tried converting the double (value1) into a string then test it using .contains method.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>