StringBuilder类的reverse()实现字符串反转

csdn大佬总结的好,原文地址

 public static String  reverse1(String str) {
         StringBuilder stringBuilder = new StringBuilder(str);
         StringBuilder str2 = stringBuilder.reverse();
         return str2.toString();
  }

你可能感兴趣的:(Java常用函数)