From charlesreid1

Revision as of 17:41, 13 June 2017 by Admin (talk | contribs)

To check if a String in Java is numeric, build a simple utility function:

public static boolean isNumeric(String str)  
{  
  try  
  {  
    double d = Double.parseDouble(str);  
  }  
  catch(NumberFormatException nfe)  
  {  
    return false;  
  }  
  return true;  
}


Flags





See also: