本文翻译自:How can I clear or empty a StringBuilder? [duplicate]
This question already has an answer here: 这个问题已经在这里有了答案:
- Clearing a string buffer/builder after loop 8 answers 循环 8回答 后清除字符串缓冲区/生成器
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. 我在循环中使用StringBuilder ,每隔x次迭代,我想将其清空并从一个空的StringBuilder
开始,但是在文档中看不到任何类似于.NET StringBuilder.Clear的方法&