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

asd zxc qwe -> qwe zxc asd

posted @ 2019-09-14 21:17  西红市菜鸡  阅读(497)  评论(0编辑  收藏  举报