标签:tchar 截取 builder 字符串 元素 插入 添加 div 方法
//默认16个长度char[]存储如果传入字符串则str.length+16 StringBuffer sb = new StringBuffer(); //添加功能 StringBuffer append = sb.append("a"); //删除元素 StringBuffer delete = sb.delete(1, 2); //删除单个字符 StringBuffer stringBuffer = sb.deleteCharAt(1); //改 StringBuffer asd = sb.replace(1, 2, "asd"); sb.setCharAt(0,‘m‘); //插入 StringBuffer zxcv = sb.insert(1, "zxcv"); //倒转 StringBuffer reverse = sb.reverse(); //查找首次出现 int zx = sb.indexOf("zx"); //截取 String substring = sb.substring(1, 2); //获取字符 char charAt = sb.charAt(1);
StringBuffer和StringBuilder使用和方法
标签:tchar 截取 builder 字符串 元素 插入 添加 div 方法
原文地址:https://www.cnblogs.com/aikang525/p/12115193.html