This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes StringUtils.isEmpty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "StringUtils.isEmpty" Watch "StringUtils.isEmpty" New topic
Author

StringUtils.isEmpty

Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
Dear All,

Please define the meaning of ,are they define as
checks if a String contains text


Sample Code:
(!StringUtils.isEmpty(asset.getSerialNumber()))
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Note that the class StringUtils is not a class from the standard Java API. It's probably a class from some library, or even defined in your own software.

Most likely it checks if the string that you pass in is null or "". It's just a convenience method, so that you don't have to write code like this all the time:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
Noted.Thanks a lots.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Empty may or may not also mean that a String only contains whitespace. If you're talking about Apache Commons Lang then they have a separate method for that, StringUtils.isBlank.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
True,Agree with you :Empty may or may not also mean that a String only contains whitespace. If you're talking about Apache Commons Lang then they have a separate method for that, StringUtils.isBlank.

Noted with thanks.
Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40

Dear All,

I like to know what "messageBundle = new MessageBundle();" maintainly do in JSP.

I am confuse on the phrase of "bundle" as the code list above.

Chan Mei Ling

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Please UseOneThreadPerQuestion, don't append a new and unrelated question to an old, existing forum topic.
Premila Devi Dayalan
Ranch Hand

Joined: Jul 19, 2009
Posts: 40
so sorry.
chan mei ling
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: StringUtils.isEmpty
 
Similar Threads
null and not null in java
How to use DetachedCriteria in multiple table?
Problem with named Query for a search
Custom Component in JSF
Clean Code: LOC in method