Editing a text file
I'm trying to make a program that edits the text from a file and saves the text with a different name. I know how to copy the file with a different name, but I don't know how to alter the text inside it.
Lets say I have a file called MyTextFile.txt with the content "abcd". I want the program to create a file called MyTextFileModified.txt with the content "bcde"
Also, I'd like it to work for long files, and maybe for word files.
Re: Editing a text file
So, do you want it to change it to 'bcde' every time or do you want it to be something that you decide upon?
Originally Posted by alexix
What is a long file?
What is a word file?
You can always read line by line using a BufferedReader + FileReader and get the content of a .txt-file. If you know how to work with files I'm sure you'll be able to do this.
If you want to read MS Word documents, have a look at the POI API - Apache POI - the Java API for Microsoft Documents