This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes replace a string in a file using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "replace a string in a file using Java" Watch "replace a string in a file using Java" New topic
Author

replace a string in a file using Java

terry Kiernan
Ranch Hand

Joined: Aug 23, 2008
Posts: 31
Hi ,

Anyone know a simple way i can replace a string in a file using java ?

Thanks
[ August 23, 2008: Message edited by: nanoj ]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

After checking your private messages, take a look at the String class in the API, which has various replace methods.

Or is your question about file handling? If so, you will need to give us more information about what you've tried and where you're stuck.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: replace a string in a file using Java
 
Similar Threads
Replacing a word in a text file
How to replace data in a file
replacing a regex wild card
Editing html tags in a *.htm file
Code to Modify the contents of a file