[Logo]
Forums Register Login
how to get reverse string
Hi,

can any one can explain how to display the given string as reverse string. if you have example code post that.

thanks in advance.
I think this will help you

String as="htapmas";
String temp="";
for(int x=as.length()-1;x>-1;x--){
temp+=as.charAt(x);
}
System.out.println(temp);
Or you can use http://download.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/java/lang/StringBuffer.html#reverse() to do that.
Thank you sampath.its working
Look ma! I'm selling my stuff!
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


This thread has been viewed 928 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 19, 2018 05:56:41.