BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I change data in a file?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder JavaAPI
View previous topic :: View next topic  
Author Message
Eun
Guest





PostPosted: Tue Oct 14, 2003 9:29 pm    Post subject: How can I change data in a file? Reply with quote



Hi.

I have a file "test.txt" with data below;
--------------------
LB = 0.1500000

OPP = 30.00000

MAX = 40.00000

------------------------------

I want to change the numbers and save the file.

Can anyone please let me know what I should do?

Thanks.




Back to top
Paul Furbacher [TeamB]
Guest





PostPosted: Wed Oct 15, 2003 4:22 am    Post subject: Re: How can I change data in a file? Reply with quote



In <3f8c6a8e$1 (AT) newsgroups (DOT) borland.com> Eun wrote:

Quote:
I have a file "test.txt" with data below;
--------------------
LB = 0.1500000

OPP = 30.00000

MAX = 40.00000

------------------------------

I want to change the numbers and save the file.

Adrian provided one way of solving your problem (see
parallel response).

However, if you are open to changing the file extension
from .txt to .properties, you could use the java.util.Properties
class to handle this very easily.


Paul Furbacher [TeamB]

Save time, search the archives:
http://info.borland.com/newsgroups/ngsearch.html

Is it in Joi Ellis's Faq-O-Matic?
http://www.visi.com/~gyles19/fom-serve/cache/1.html

Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.

Back to top
Valentino Kyriakides
Guest





PostPosted: Wed Oct 15, 2003 10:17 am    Post subject: Re: How can I change data in a file? Reply with quote




"Eun" <gte521w (AT) prism (DOT) gatech.edu> schrieb im Newsbeitrag
news:3f8c6a8e$1 (AT) newsgroups (DOT) borland.com...
Quote:
Hi.

I have a file "test.txt" with data below;
--------------------
LB = 0.1500000

OPP = 30.00000

MAX = 40.00000

------------------------------

I want to change the numbers and save the file.

Can anyone please let me know what I should do?


There are many different approaches available to handle this. Beside those
Adrian and Paul told you, you could for example read in and write out your
data also in a tab delimited format, as most spreadsheets and databases
would also support. Instead you could also write out and read in your data
in a well formed XML format etc. etc.

However, as Paul said, the easiest would really be to make use of Java's
Properties class to handle this and in case you don't like to have those
".properties" extensions, take one of those java based INI read/write file
examples and set it up in a way to work on your ".txt" extension. As an
example see:

http://www.codeguru.com/java/articles/655.shtml

http://www.geocities.com/Area51/9851/INIFiles.html

....and so on...

You can find a lot of similar and even more advanced such java based INI
read/write examples on the internet.

-Valentino



Back to top
Eun
Guest





PostPosted: Wed Oct 15, 2003 5:28 pm    Post subject: Thanks a lot! Reply with quote

I just got the job done.
Appreciate it.

- Eun


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder JavaAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.