File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes usage of stringbuffer length. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "usage of stringbuffer length." Watch "usage of stringbuffer length." New topic

usage of stringbuffer length.

sowmya vasisht
Ranch Hand

Joined: Aug 23, 2001
Posts: 35
Can anybody help me in knowing how to truncate Stringbuffer elements when it exceeds some predetermined legnth without loosing data.
first in a while loop of vector i m appending the account number, then the account status to a string buffer. but when the length of the string buffer exceeds a predetermined length, for eg., if the legnth has to be 400, then if the addition of accoutn number and status is more than 400 then it should remove the last added number and status. and pass the data which is less than 400 or equal to.
Could anybody tel me how to go about it??
thanx in advance.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi sowmya,
You can try something like this:

Hope this helps,
Michael Morris

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
I agree. Here's the link:
subject: usage of stringbuffer length.
jQuery in Action, 3rd edition