In PHP it's
strrev(), in Rails it's
.reverse, but most languages don't have any string reverse function. Some have array reverse functions that can be used on characters. I was thinking this must be a major oversight but then it occurred to me, what would you actually use string reverse for???
The only time I can think I've seen it is in demos and lessons to turn "Hello World!" into "!dlroW olleH".
My question is; Is there a use for reversing a string or is it completely pointless?
There have been way more answers that I had anticipated and not all of them were entirely academic. I would have put money that no one could come up with a legitimate example. I also didn't think I would learn anything new but Mark Canlas' regex suggestion is just brilliant and I look forward to the opportunity for it to prove itself. Thanks to all.