aspose file tools*
The moose likes Servlets and the fly likes Checking string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Checking string" Watch "Checking string" New topic
Author

Checking string

sreeni san
Ranch Hand

Joined: Aug 14, 2001
Posts: 39
Hi
I retrieve data(String values of X column) from Database.
Data in database will be any of the three
a. "NULL"
b. some value
c. nothing(blank)
note: blank refers to empty not blank space

I need to set values based on the data(String) received like
If the value is not null
if(data!=null or when data is empty)
x="y";
I am facing problems when data is empty. How will my if condition be?
It cannot be if (data.length==0) or if(data.equals("")) as when data will be "null", null pointer exception will be thrown
Kindly suggest a suitable soluton.
Thanks
sreeni
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
There is a wasNull()method in the ResultSet interface. it indicates if the recently retrieved column is null

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checking string