stringbuilder去除空格 stringbuilder清空
大家好,我是小典,我来为大家解答以上问题。stringbuilder去除空格,stringbuilder清空,很多人还不知道,现在让我们一起来看看吧!
StringBuilder strBuilder=new StringBuilder();
StringBuilder strBuilder2 = new StringBuilder();
strBuilder.Append("string_1");
strBuilder.Append("string_2");
strBuilder.Append("string_3");
strBuilder.Append("string_4");
strBuilder = new StringBuilder();
strBuilder2.Append("string_5");
strBuilder2.Append("string_6");
strBuilder2.Append("string_7");
strBuilder2.Append("string_8");
strBuilder2.Remove(0, strBuilder2.Length);
自己去设个断点,看结果 ─ 2个都是为空了。
Images_1:
Images_2:
本文到此讲解完毕了,希望对大家有帮助。