How can I clear or empty a StringBuilder?

836    Asked by BenButler in Devops , Asked on Apr 20, 2021

I'm using a StringBuilder in a loop and every x iterations I want to empty it and start with an empty StringBuilder, but I can't see any method similar to the .NET StringBuilder. Clear in the documentation, just the delete method which seems overly complicated. So  how to  clear StringBuilder in Java?

Answered by Benjamin Moore

Your Answer

Interviews

Parent Categories