嗨,對不起。查找字符串並在java文本文件中追加文本
這是一個文本文件
[TESTRESULT]
testdate=5/16/2013
testtime=20:03:00
operator=Jacob Poulsen
test_no=62495
axles_tested=2
[AXLE1RESULT]
fric_l=38
fric_r=51
p0_l=0
p0_r=0
fl=280
fr=300
所以我覺得問題的 首先找到字符串例如:
第二附加文本[AXLE1RESULT]
喜歡這個
[TESTRESULT]
testdate=5/16/2013
testtime=20:03:00
operator=Jacob Poulsen
test_no=62495
axles_tested=2
[SomeText]
Something=0
Something=0
Something=0
[AXLE1RESULT]
fric_l=38
fric_r=51
p0_l=0
p0_r=0
fl=280
fr=300
之前,我應該怎麼做???
我不能完全告訴你的要求;但這些文件被格式化爲Windows INI文件。也許http://stackoverflow.com/questions/190629/what-is-the-easiest-way-to-parse-an-ini-file-in-java將有所幫助(ini4j可以讀取,解析和編寫它們,並且會讓你輕鬆修改值)。 –