|
|
|
1000 Java Tips ebook
|
|
 

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!. |
|
I am reading my values from a db which is supposed to be a string, but sometime
|
JavaFAQ Home » Databases

Question: I am reading my values from a
db which is supposed to be a string, but sometime they can be doubles or
something else...
How could I check if a string was double?
Answer: You can try to try to parse the
String into a double and catch the exception:
String mystr="1.6";
try {
Double dbl = new Double(s);
// do smth. here}
catch (NumberFormatException ex) {
// d smth. else here
}
***************************************
Our older tips: March 22, 2001 - October 21, 2002
read here.
All published and not published on site tips you can find
here Printer Friendly Page
Send to a Friend
..
Search here again if you need more info!
|
|
|