1 /** 2 * java常见字符串的操作 3 */ 4 public class Test7 { 5 public static void main(String args[]){ 6 StringBuffer sBuffer = new StringBuffer("ABCDEF"); 7 sBuffer.append("abcdef"); 8 sBuffer.append(".123"); 9 sBuffer.append(".456"); 10 System.out.println(sBuffer);//原始字符串 ABCDEFabcdef.123.456 11 System.out.println(sBuffer.delete(0,5));//字符串截取 Fabcdef.123.456 12 System.out.println(sBuffer.reverse());//字符串反转 654.321.fedcbaF 13 } 14 }
时间: 2024-12-12 17:18:14