forum

home / developersection / forums / java regex to split and reverse string

Java RegEX To Split and Reverse String

Anonymous User 3869 28-Sep-2013
I have a Java String "test/this/string" that I want to reverse to "string/this/test" using a regular expression or the most efficient Java algorithm. The way I know is to use the split method, loop over the array and rebuild the string manually. The number of "/" can vary and doesn't occur a fixed number of times. Any ideas?

Updated on 28-Sep-2013

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By