posted 21 years ago
Hi folks,
I have a strange (?) problem in underlying code and can't see why:
void setTextTmp(StringBuffer sb)
{
System.out.println("setTextTmp (sb): "+sb.toString());
this.sbtexttmp.setLength(0);
this.sbtexttmp.append(sb.toString());
System.out.println("setTextTmp: "+sbtexttmp.toString());
//this.sbtexttmp = sb ; //new StringBuffer(s);
}
I want to reuse the sbtexttmp StringBuffer, so I put the length to zero and then append the sb StringBuffer.
The problem is that this doesn't seem to work!
After the append the sbtexttmp stringBuffer stays empty .
If I use 'this.sbtexttmp = sb ' then it does work.
Does anyone have any idea ?
Thx,
Stefan