java常见字符串的操作

时间:2022-09-07 15:03:40
 /**
  * java常见字符串的操作
  */
 public class Test7 {
     public static void main(String args[]){
         StringBuffer sBuffer = new StringBuffer("ABCDEF");
         sBuffer.append("abcdef");
         sBuffer.append(".123");
         sBuffer.append(".456");
         System.out.println(sBuffer);//原始字符串  ABCDEFabcdef.123.456
         System.out.println(sBuffer.delete(0,5));//字符串截取   Fabcdef.123.456
         System.out.println(sBuffer.reverse());//字符串反转  654.321.fedcbaF
     }
 }