如何清空StringBuilder?
提問人:劉冬梅發(fā)布時間:2020-10-12
1、Remove例:
StringBuilder val = new StringBuilder();
val.Append("....");
val.Remove(0,val.Length);//清空
2、Replace
StringBuilder val = new StringBuilder();
val.Append("....");
val.Replace(val.ToString(), "");//清空
3、Length
StringBuilder val = new StringBuilder();
val.Append("....");
val.Length = 0;//清空經(jīng)過測試第三種效率更高,推薦用第三種!
繼續(xù)查找其他問題的答案?
相關(guān)視頻回答
點擊加載更多評論>>