1

我想颠倒25/0字符串中单词(例如)的顺序。

如下例:

In Normal:        25/0 24/5 23/9 23/7 23/9
After Relocation: 23/9 23/7 23/9 24/5 25/0  // I want this my output

如何通过 jQuery 或 javascript 来完成?
请告诉我以防万一http://jsfiddle.net/

4

1 回答 1

11

See http://jsfiddle.net/A8End/

var text="25/0 24/5 23/9 23/7 23/9";
alert(text.split(' ').reverse().join(' '));

You can split the text in order to have an array. Then you can easily reverse it and join it to a string again.

于 2012-08-30T21:34:23.177 回答