1 public String reverse(String str){ 2 String s = ""; 3 String[] strings = str.split(" "); 4 for (int i = strings.length - 1; i > 0 && i<strings.length ; i--) { 5 s = strings[i] + " "; 6 } 7 return s; 8 }
asd zxc qwe -> qwe zxc asd
原文地址:https://www.cnblogs.com/carry6/p/11520312.html
时间: 2024-11-09 00:40:40