Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By Zyril

Thread: Editing a text file

  1. #1
    alexix is offline Member
    Join Date
    Feb 2013
    Posts
    19
    Rep Power
    0

    Default 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.

  2. #2
    Zyril is offline Senior Member
    Join Date
    Oct 2011
    Location
    Sweden
    Posts
    124
    Rep Power
    0

    Default Re: Editing a text file

    Quote Originally Posted by alexix View Post

    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.
    So, do you want it to change it to 'bcde' every time or do you want it to be something that you decide upon?
    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
    alexix likes this.

Similar Threads

  1. Simple Text File Editing in Java help
    By DMarsh12 in forum New To Java
    Replies: 1
    Last Post: 10-22-2011, 09:55 PM
  2. editing a file. Am I doing this right?
    By Mokomi in forum New To Java
    Replies: 2
    Last Post: 10-14-2011, 04:40 AM
  3. Editing text files
    By NickBru in forum New To Java
    Replies: 4
    Last Post: 12-05-2010, 06:27 PM
  4. Text editing
    By right2001 in forum New To Java
    Replies: 1
    Last Post: 04-10-2009, 07:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •