package com.company;
import java.util.Scanner;
//13 insert (位置,插入的内容)
public class Demo03 {
/*
* StringBuffer 是String的增强类,加了缓冲区,效率更高* @param args
* */
public static void main(String[] args) {
StringBuffer sb =new StringBuffer("生活不止眼前的苟且");
StringBuffer sb1 = sb.append(",");
System.out.println(sb1); //等价于System.out.println(sb1.toString());
StringBuffer sb2 = sb1.append("还有诗和远方的田野");
System.out.println(sb2);
StringBuffer sb3 = sb2.append(false);
System.out.println(sb3);
System.out.println("请输入一串数字");
Scanner sc =new Scanner(System.in);
String s1 = sc.next();
StringBuffer sb4 =new StringBuffer(s1);
for (int i = sb4.length()-3 ; i >0 ; i ++ ) {
sb4.insert(i,",");
System.out.println(sb4);
}
}
}