标签:des style blog class code java
/** * * @description * <p>String utils</p> * @author Czp * @version 1.0(2014-5-9) * */ public class StringUtil { /** * @description: * <p>反转字符串,如果参数为null或为空窜将返回原对象</p> * @param str * @return */ public static String reverseString(String str) { if (str == null || str.isEmpty()) return str; char[] arr = str.toCharArray(); int len = arr.length - 1; for (int i = 0; i < len; i++, len--) { char tmp = arr[i]; arr[i] = arr[len]; arr[len] = tmp; } return new String(arr); } }
标签:des style blog class code java
原文地址:http://www.cnblogs.com/czpblog/p/3719682.html