SuvenduSekhar Panda wrote:My requirement is to reverse the string but not the words in them.
Then you should have told us that at the start. Learning how to ask questions is very important, otherwise we can spend a lot of time on things that don't help you.
So, if you're not allowed to use
String.split() (which IS a String function), then
you will have to determine when a
word break occurs. Just one way would be to store the indexes of every space in your string (assuming that "words" can only be broken up with spaces), and then use that array of values to create (or
print())
substring()s in reverse sequence.
You may also want to have a look at
String.indexOf(char, int) and
String.lastIndexOf(char, int) to help you out.
HIH
Winston