Article View: borland.public.jbuilder.java.api
Article #368Re: How can I change data in a file?
From: Valentino Kyriakides
Date: Wed, 15 Oct 2003 10:17
Date: Wed, 15 Oct 2003 10:17
42 lines
2348 bytes
2348 bytes
"Eun" <gte521w@prism.gatech.edu> schrieb im Newsbeitrag news:3f8c6a8e$1@newsgroups.borland.com... > 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
Technical Details
Message-ID:
<3f8d1e24$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f8c6a8e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,8cb841adb87efb60 X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2003-10-15 03:40:04 PST From: "Valentino Kyriakides" <vkyr@nospam-ision.net> Newsgroups: borland.public.jbuilder.java.api References: <3f8c6a8e$1@newsgroups.borland.com> Subject: Re: How can I change data in a file? Date: Wed, 15 Oct 2003 12:17:11 +0200 Lines: 44 Organization: Kyriakides X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 80.171.8.173 Message-ID: <3f8d1e24$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1066212900 80.171.8.173 (15 Oct 2003 03:15:00 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail