A Function to Determine Whether a String Can Be Converted to a Number

The following code shows how to determine whether one string is a number:

public static boolean isNumber(String s){  try  {    new Double(s);    return true;  }  catch(Exception ecc)  {    return false;  }}
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: