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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 1958
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to reverse the contents of a text file
 
Similar Threads
calling a button from utility file
Radix Sort
Reading a file in reverse order
String reversal program
Java: Convert a binary file to "text" and back again.