Re: Java

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Ben Coffman
Date:  
To: ryan
CC: plug-discuss
Subject: Re: Java
I am trying to use the replaceAll() method, but I cannot get it to work.
i'm trying to pass in a variable and I want it to replace everything that is
in that variable?

firstLineString is of type string also.

editedFile.replaceAll(firstLineString, "Work you silly code");

Thanks,

Ben



Ben Coffman said:

> I have a file I want to locate a word within the file and then erase that
> word without erasing the rest of the file.


Read your file into a StringBuffer and call replaceAll() on the buffer's
contents with an empty replacement to wipe all occurrances of your word.
Then, write over your old file with the new String.

Ryan Calder


_________________________________________________________________
Express yourself with the new version of MSN Messenger! Download today -
it's FREE! http://messenger.msn.com/go/onm00200471ave/direct/01/

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss