Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Advanced
Nov 4, 2008

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;
  }
}
Roberto Chiavolini
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap