Read a File and Replace a String from a JAVA ProgramThis Java sample program shows illustrates two things. 1. How to replace a string with another string. 2. How to read from a file and write to a File from Java. This program was needed in one of my projects where I get a text file A which is updated every two minutes by another program. I had to read this file and replace the occurrence of a particular String in that file with another String. However I cannot edit the file A since it was shared by other programs. Therefore after I replaced the String I created my own file B for my further processing. This free sample program does just that. |
|
|