Try to parse your string into double
and compare it to 0
:
if(Double.valueOf(yourText) == 0)
{
//do something scary
}
题
How to avoid 0 and 0.0 and 0.00 and 0.000 and 0.0000 e all the other "zeros" the user can type. If were for only one, I know how to do with string comparison, but I have this problem with several strings, but only one meaning.
解决方案
Try to parse your string into double
and compare it to 0
:
if(Double.valueOf(yourText) == 0)
{
//do something scary
}