Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Test a stringbuffer for empty contents and how to clear?

843835Nov 14 2002 — edited Nov 15 2002
Hi i have two questions.

1) How do i clear the contents of my stringbuffer.
buffer = new StringBuffer(); --> creates a new object I think. Is there a way to clear like buffer = "";

2) How to test if a stringbuffer is empty? I do this and it always thinks that its not empty.
buffer = new StringBuffer();
if(!buffer.equals("")){
//I always get here and should not
}

Thanks in advance. I dont see that there is an isEmpty() method either..


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2002
Added on Nov 14 2002
2 comments
214 views