RE: Java

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Earl, Alex C
Date:  
To: plug-discuss
Subject: RE: Java
I think you need to do:

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

The replaceAll method returns a String, which I assume is the changed
string.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#replaceAll
(java.lang.String,%20java.lang.String)


Alex

> -----Original Message-----
> From:

[mailto:plug-discuss-
> ] On Behalf Of Ben Coffman
> Sent: Monday, May 03, 2004 2:26 PM
> To:
> Cc:
> 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


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