JAVA StringBuffer类
学习笔记,转自:http://www.cnblogs.com/springcsc/archive/2009/12/03/1616330.html
?
?
一、append 方法
?
使用该方法进行字符串的连接,将比String更加节约内容,例如应用于数据库SQL语句的连接,例如:
StringBuffer sb = new StringBuffer();
String user = “test”;
String pwd = “123”;
sb.append(“select * from userInfo where username=“)
.append(user)
.append(“ and pwd=”)
.append(pwd);
这样对象sb的值就是字符串“select * from userInfo where username=test and pwd=123”。