Once you replace the first word with the last word, there are now two "last" words in the String.
You may have to do the same trick you use when you are swapping items in an array.
Something...
Type: Posts; User: Norm
Once you replace the first word with the last word, there are now two "last" words in the String.
You may have to do the same trick you use when you are swapping items in an array.
Something...
Where did you print out the values of word and lastword for debugging?
Also print out the values of the first and last variables to see what your code is doing.
For debugging you should print out the values of word and lastword so you can see what the code is doing.