I have this string s1 = \"My name is X Y Z\" and I want to reverse the order of the words so that s1 = \"Z Y X is name My\".
string s1 = \"My name is X Y Z\"
s1 = \"Z Y X is name My\"
I can do it u
What language? If PHP, you can explode on space, then pass the result to array_reverse.
If its not PHP, you'll have to do something slightly more complex like:
words = aString.split(" "); for (i = 0; i < words.length; i++) { words[i] = words[words.length-i]; }