How can I use this but not return FALSE because of decimal in numbers?
public class isNumeric
{
// This method checks if a String contains only numbers
public boolean isNumeric(String str)
{
//It can't contain only numbers if it's null or empty
if (str == null || str.length() == 0)
return false;
for (int i = 0; i < str.length(); i++)
{
//non-digit character returns false.
if (!Character.isDigit(str.charAt(i)))
return false;
}
return true;
}
}