using System; using System.Data; using System.Text; class Test { static void Main() { StringBuilder sb = new StringBuilder(); sb.Append("aaa"); sb.Append("bbb"); Console.WriteLine(sb.ToString()); Console.ReadLine(); } }
StringBuffer可变长字符串
append向尾部追加
用法:
StringBuffer sbf=new StringBuffer("hahaha");
sbf.append("1111").append("2222");
System.out.println(sbf);
打印结果:hahaha11112222
例如:
using System; using System.Data; using System.Text; class Test { static void Main() { StringBuilder sb = new StringBuilder(); sb.Append("aaa"); sb.Append("bbb"); Console.WriteLine(sb.ToString()); Console.ReadLine(); } }