File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes how to reverse the contents of a text file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "how to reverse the contents of a text file" Watch "how to reverse the contents of a text file" New topic
Author

how to reverse the contents of a text file

aakash bose
Greenhorn

Joined: Jun 10, 2013
Posts: 4

hi guyz!! I want to read the characters from a text file and print each character in reverse order. e.g
if the file SAMPLE.txt is:
abc
def
ghi

my output should be
ihj
fed
cba


K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2370
    
    7

You may want to check the JavaRanch jr.jar javadoc Str class. http://www.javaranch.com/doc/com/javaranch/common/Str.html

Or other API that does string manipulation rather than writing your own.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
 
jQuery in Action, 2nd edition
 
subject: how to reverse the contents of a text file