//append 字符串拼接的方法
StringBuffer stringBuffer = new StringBuffer("我爱中国!");
StringBuffer stringBuffer2 = stringBuffer.append("我爱故乡!");
System.out.println(stringBuffer2);
//charAt 获取指定索引处的字符
StringBuffer stringBuffer3 = new StringBuffer("I LOVE CODE");
char c = stringBuffer3.charAt(2);
System.out.println(c);
//setCharAt 将指定索引处的字符替换为相应的字符
StringBuffer stringBuffer4 = new StringBuffer("I LOVE CODE");
stringBuffer4.setCharAt(0, 'Y');
System.out.println(stringBuffer4);
//insert 往指定的位置插入相应的字符
StringBuffer stringBuffer5 = new StringBuffer("12345678");
for (int i = stringBuffer5.length()-3; i > 0 ; i = i-3) {
stringBuffer5.insert(i, ',');
}
System.out.println(stringBuffer5);
//delete 删除从指定位置开始 到指定位置结束的字符串
StringBuffer stringBuffer6 = new StringBuffer("My Name Is Not ChenChuanYin");
stringBuffer6.delete(11, 15);
System.out.println(stringBuffer6);
//replace 将指定索引位置开始位置到结束索引位置结束之间的字符转 用相应的字符串替换
StringBuffer stringBuffer7 = new StringBuffer("My SEX IS WOMAN");
stringBuffer7.replace(10, 15, "MAN");
System.out.println(stringBuffer7);
//reverse 将字符串倒序输出
StringBuffer stringBuffer8 = new StringBuffer("12321");
StringBuffer stringBuffer9 = stringBuffer8.reverse();
System.out.println(stringBuffer9);