MCPcopy Index your code
hub / github.com/SeanDragon/protools / reverse

Method reverse

common/src/main/java/pro/tools/data/text/ToolStr.java:268–282  ·  view source on GitHub ↗

反转字符串 @param s 待反转字符串 @return 反转字符串

(String s)

Source from the content-addressed store, hash-verified

266 * @return 反转字符串
267 */
268 public static String reverse(String s) {
269 int len = length(s);
270 if (len == 0) {
271 return s;
272 }
273 int mid = len >> 1;
274 char[] chars = s.toCharArray();
275 char c;
276 for (int i = 0; i < mid; ++i) {
277 c = chars[i];
278 chars[i] = chars[len - i - 1];
279 chars[len - i - 1] = c;
280 }
281 return new String(chars);
282 }
283
284 /**
285 * 转化为半角字符

Callers

nothing calls this directly

Calls 1

lengthMethod · 0.95

Tested by

no test coverage detected