Advertisement

02.07.2007 at 07:41PM PST, ID: 22154287
[x]
Attachment Details

What's the most efficient way to replace a certain string within a text file?

Asked by StephenSpeaks in Java Programming Language

Tags: efficient

Here's the scenario we're trying to do:

- I have a text file with a number of lines that vary in length
- Within that textfile, we have a wildcard (we settled with "#date" as the wildcard)
- What we need to do is process the file such that the output is that the same file, but with the wildcard replaced with a certain string parameter... For this example, let's say it's a date such as '2007-02-08'

So basically, we just want to change the contents of a certain file such that the file remains exactly the same, except for the wildcard (#date) being changed with the actual date parameter that we need ('2007-02-08')

Any suggestions? We're only familiar with the common BufferedReader BufferedWriter approach, but currently don't have any idea how we're going to use it. If there are any alternatives whatsoever, it will be greatly appreciated.



Start Free Trial
 
Loading Advertisement...
 
[+][-]02.07.2007 at 07:46PM PST, ID: 18491007

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Tags: efficient
Sign Up Now!
Solution Provided By: avya2k
Participating Experts: 3
Solution Grade: A
 
 
[+][-]02.07.2007 at 07:48PM PST, ID: 18491018

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2007 at 09:37PM PST, ID: 18491385

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.07.2007 at 09:57PM PST, ID: 18491440

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.07.2007 at 09:58PM PST, ID: 18491447

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2007 at 10:06PM PST, ID: 18491486

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2007 at 10:07PM PST, ID: 18491488

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2007 at 10:14PM PST, ID: 18491507

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2007 at 10:22PM PST, ID: 18491534

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.08.2007 at 02:12AM PST, ID: 18492481

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.08.2007 at 02:45AM PST, ID: 18492630

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.10.2007 at 11:26AM PST, ID: 18508047

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03.21.2007 at 10:23AM PDT, ID: 18765682

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]03.22.2007 at 12:40AM PDT, ID: 18769607

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2007 at 02:16PM PDT, ID: 19441424

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07.16.2007 at 05:05PM PDT, ID: 19501126

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32