字符串反转变形(asd zxc qwe -> qwe zxc asd)
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 }
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 }